How to get integer pixel coordinates from roi rectangle?
Show older comments
I am having a trouble getting the pixel values from my roi rectangle. For example i have an 1200x1600 image, when i select the bottom right corner i get x2 y2 values as 1200.5 and 1600.5. Also other position values are floats such as 54.245. I want my xi yi positions as integer values because i am going to use these points later for image processing. I tried using round() function but it didnt work.
My code is:
ax=gca;
roi= drawrectangle(ax);
position =roi.Position;
x1 = position(1);
x2 = x1 + position(3);
y1 = position(2);
y2 = y1 + position(4);
Accepted Answer
More Answers (0)
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
