How to get integer pixel coordinates from roi rectangle?
이전 댓글 표시
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);
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 ROI-Based Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

