Ah. Discovered the xticks and xticklabels functions (and even the ones for the y and z axes). Nice. Would be even nicer if there was a global scale factor one could apply to tick labels so that one could zoom and pan an image and let the tick marks stay auto-determined but the tick labels remain scaled, but you can't have everything.
How do I scale the units of a displayed image?
조회 수: 6 (최근 30일)
이전 댓글 표시
Some of the images I display have real-world pixels sizes of, say, 0.5m, and some have sizes of, say, 2m. When I display the image, I'd like the x and y axes to scale appropriately and show units of meters instead of pixels.
I can get the XTickLabel and YTickLabel arrays for both axes and multiply them by the appropriate scaling factor (after converting the cell arrays to doubles, then converting back to cell arrays afterwards). But when I interact with the image (using the pan or zoom tools), the tick mark labels get screwed up.
For example - at left is my full image after scaling the axes tick marks to show size in meters. The actual image is 2347x2174, but since they're 0.5m pixels, the axes limits are half that. At right is the image afer zooming in on the large feature in the middle. The tick mark labels are incorrect.
It seems that Matlab is taking my manually-set Tick Labels and applying them to the image in 1-N order, no matter what tick marks correspond to the current pan and zoom levels of the image. Is this a bug, or is there something I'm not doing to keep the manual Tick Labels dynamic?
Thanks.
채택된 답변
Image Analyst
2021년 4월 26일
You can put in the axes limits into imshow() with the 'XData', and 'YData' options.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Exploration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!