How do I add a grid over this image?

I'm wanting to add a 10x10 grid over the image in the figure below. I produced this density plot using image(), but wish to add an outline to each small square. I have seen examples of how to add a grid over an image, but this involves modifying columns and rows of pixels and setting their colour to black, however, since each small square in my figure is a pixel, this doesnt work. Any help/suggestions anyone may have would be greatly appreciated.
Thanks

 採用された回答

Image Analyst
Image Analyst 2019 年 3 月 10 日

0 投票

Try line:
[rows, columns, numberOfColorChannels] = size(rgbImage);
hold on;
for row = 10:10:rows
line([1, columns], [row, row], 'Color', 'r');
end
for col = 10:10:columns
line([col, col], [1, rows], 'Color', 'r');
end

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

製品

タグ

質問済み:

2019 年 3 月 10 日

回答済み:

2019 年 3 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by