The four-element position vector using getPosition returns double values rather than integers.
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi everyone,
The four-element position vector returned after selecting rectangle or ellipse or other shapes in an image as a result of imrect, imellipse functions using getPosition function is of type double. When the first two elements represent the coordinates of the top left corner of the rectangle and the next two elements represent the width and height of the rectangle, all the four values are expected to be integers because the image is discrete and the values are in units of 'number of pixels' (I assume).
It does not make sense for the coordinates or width and height to be double. Can anyone explain the reason for the vector to have double values, which means that it is giving us sub-pixel accuracy ?
-- Thanks in advance, Ram.
Risposte (2)
Azzi Abdelmalek
il 25 Ago 2012
imshow('pout.tif');
h = imrect;
position = wait(h);
% the result is double but without decimals. if you want the result to be integer
position = uint32(position);
0 Commenti
Ramaprasad Kulkarni
il 27 Ago 2012
2 Commenti
Walter Roberson
il 27 Ago 2012
What Units are you using? The Position is possibly being stored in a different unit than you are using, resulting in a non-integral value when you examine it.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!