Code covered by the BSD License  

Highlights from
myLabel 0.04

image thumbnail
from myLabel 0.04 by Nikolay Chumerin
Image labeling tool for Matlab.

check_boundaries(x1, y1, x2, y2, im_width, im_height)
function [x1 y1 x2 y2] = check_boundaries(x1, y1, x2, y2, im_width, im_height)
% check boundaries
x1 = ceil(x1); x2 = floor(x2);
y1 = ceil(y1); y2 = floor(y2);
if x1<1, x1 = 1; end
if y1<1, y1 = 1; end
if x2>im_width, x2 = im_width; end
if y2>im_height, y2 = im_height; end

Contact us at files@mathworks.com