edgecolor of pixels of imagesc
50 ビュー (過去 30 日間)
回答 (3 件)
Image Analyst 2020 年 5 月 25 日
編集済み: Image Analyst 2020 年 5 月 25 日
You can't. And if you use pcolor, you don't either. The tiles you see in pcolor are NOT pixels. Look closely. If you want to show a 4x4 array with pcolor, do you see a 4x4 array of pixels?
m = magic(4)
No, you don't. Those black lines goes through the MIDDLE of the pixels, they don't surround them. And to make it worse, you see a 3x3 array of tiles, not a 4x4 array. Very deceiving so that's why I never use pcolor().
Aaron T. Becker's Robot Swarm Lab 2021 年 1 月 25 日
Consider using the code Pixel Grid, https://www.mathworks.com/matlabcentral/fileexchange/71622-pixel-grid
The function pixelgrid superimposes a grid of pixel edges on an image. The purpose is to easily visualize pixel extents when zooming in closely on an image. The grid is drawing using lines with contrasting colors so that it is visible regardless of the colors of the underlying pixels.
Steve Eddins (2021). Pixel Grid (https://github.com/mathworks/pixelgrid), GitHub. Retrieved January 25, 2021.
Rongxing Hu 2022 年 5 月 24 日
You could use plot to add the edge lines
edge_x = repmat( [0:length(xdata)]+0.5, length(ydata)+1,1)
edge_y = transpose( repmat( [0:length(ydata)]+0.5, length(xdata)+1,1) )
plot(edge_x ,edge_y, ' k') % vertical lines
plot( transpose(deg_x), transpose(edge_y ), 'k') % horizontal lines