I have a piece of code that returns the x and y coordinates of a rectangle that I draw on a grayscale image.
frameA=read('abc.jpg'); imshow(frameA);H=imrect;Position = wait(H);
Position contains [x y h w], where x,y = xy coordinates of top left corner of rectangle, h=rectangle height, w =rectangle width. So I have all the coordinates I need.
How can I use these coordinates to modify the color of the pixels in this rectangle?
If I use frameA(x,y) = 1 for instance, the x,y here corresponds to the indices of the pixels and not their spatial coordinates.
Best Answer