How can I have impixelinfo give me pixel numbers rather than axis values?

5 visualizaciones (últimos 30 días)
I have a figure in a GUI I am making created with imagesc that I then apply impixelinfo to, because I need to know the pixel locations of certain features. However, since I am also applying axis ranges, for example:
imagesc(xAx,yAx,axesVideoFocus(:,:,currentSlice))
where xAx and yAx are vectors describing the x and y axes, impixelinfo is returning me the values of xAx and yAx rather than the pixel number I am hovering over. So say I am over pixel 32, 5. What I actually get out of impixelinfo are the x and y axis values at that pixel, instead of (32,5).
Thanks for any help.

Respuesta aceptada

Image Analyst
Image Analyst el 7 de Abr. de 2014
Then don't put in axis calibration factors. Just do this:
imagesc(axesVideoFocus(:,:,currentSlice))
assuming axesVideoFocus is the name of your 3D image variable.
  5 comentarios
Image Analyst
Image Analyst el 7 de Abr. de 2014
You can turn "axis on" which will show the tick marks in pixels, but THEN, you can redefine the tick marks to be whatever you want. So use sprintf() to create a brand new set of tick marks that displays in your custom calibrated units. Look up help on tick marks or tick labels to see how to do it.
Nicholas
Nicholas el 7 de Abr. de 2014
Thanks for pointing me in the right direction, I was able to get it working.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by