Extract contour of an image and plot it
3 次查看(过去 30 天)
显示 更早的评论
Hi,
I want to extract the contour from an image and plot the contours assuming the center of the image as the (0,0) coordinate system.
I have attached my image too.
Thanks for your help.

0 个评论
采纳的回答
Walter Roberson
2019-4-26
im = rgb2gray( imread('Picture4.png') );
contour(im,4)
There is an obvious difference between specifying 2 (contour levels) or 3. However, you have to be looking fairly closely to tell the difference between 3 vs 4. You probably will not be able to tell the difference between 4 and 5.
The image appears to be consistent with the possibility that someone converted an image to black and white, and then write the image as jpeg, and then read in the jpeg and wrote it as png. That is, the values that are not 0 (black) or 255 (white) occur only in boundary positions as-if they only existed due to the way DCT handles sharp edges (it blurs them, like anti-aliasing.)
11 个评论
Image Analyst
2023-7-29
@Jean-Parfait My demo does not reverse/invert the image intensities. I think you must have changed something. Nonetheless, I've updated a few lines in the demo and the updated code is attached.

更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
