AJA*_*AJA 3 matlab image matlab-figure
我一直在尝试使用imagesc函数显示纯黑色网格线,这样每个像素周围都有一个黑色边界.我尝试了一些方法,但似乎无论如何,线条总是通过像素.作为一个例子,对于imagesc(randn(21,21)),我试图得到一个图,其中每个正方形(即像素)这里有一个黑色边框.
我在这里找到了一个解决方案:在matlab中,如何在图像上绘制网格,但我不确定如何使用imagec,而不是a.jpg图像.
我也尝试使用hold on功能手动放置线条.但是每个解决方案,似乎网格线都穿过像素的中间.任何帮助,将不胜感激.谢谢.
请尝试以下方法:
imagesc(randn(21,21))
hold on;
for i = 1:22
plot([.5,21.5],[i-.5,i-.5],'k-');
plot([i-.5,i-.5],[.5,21.5],'k-');
end
Run Code Online (Sandbox Code Playgroud)
编辑:事物是像素的中心位于整数格点,所以要勾勒像素,你需要使用以.5结尾的坐标.
pcolor 完全是这样的:
pcolor(randn(15,21))
axis image %// equal scale on both axes
axis ij %// use if you want the origin at the top, like with imagesc
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
5951 次 |
| 最近记录: |