ROI keeps incrementing bu 1 in each dimension.

1 view (last 30 days)
Jason
Jason on 7 Apr 2014
Edited: Jason on 7 Apr 2014
if true
% code
endHello. I am using the below code to draw a box onto an image to allow the user to define which part of the image to process as an ROI (called Zoom)
h = imrect(handles.axes1, p);
p = wait(h);
p = h.getPosition();
assignin('base','p',round(p))
addNewPositionCallback(h,@(p)assignin('base','p',p));
p1=evalin('base','p');
%Get x & y coordinates
sp(1) = round(p(1)); %xmin
sp(2) = round(p(2)); %ymin
sp(3) = round(p(1))+round(p(3)); %xmax
sp(4) = round(p(2))+round(p(4)); %ymax
Zoom = IM(sp(2):sp(4), sp(1): sp(3),:); % This is the ROI
the problem is, if I monitor the size of the ROI and repeat the operations it keeps incrementing by 1 in each dimension. Could it be because of the use of the round function?
any help greatly appreciated.
thanks Jason

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!