How to show a gray scale image with its contour in one figure?
4 次查看(过去 30 天)
显示 更早的评论
Hello, guys:
I extracted two contours of a gray scale image, shown as following. But I can't make the contours shown upon the original gray scale imageg to get only one figure, I need a help, thanks a lot! The wanted result is like the third picture.
![1562415808.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/227780/1562415808.png)
![1562416539(1).png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/227781/1562416539(1).png)
0 个评论
回答(2 个)
Nils Speetzen
2019-7-6
Hi,
finalimage = imfuse(grayscaleimage, contour, 'blend');
imshow(finalimage)
The blend option uses alpha blending to combine both images.
I hope this works for you.
Image Analyst
2019-7-7
Try imshow() to display the image, then don't call subplot() or figure(). Just call "hold on" and then call plot() to plot the lines in the overlay above the figure.
imshow(grayImage);
hold on;
plot(x1, y1, 'm-'); % Draw magenta curve over image.
plot(x2, y2, 'g-'); % Draw green curve over image.
5 个评论
Image Analyst
2019-7-9
The gets the perimeter as an image, like bwboundaries() which gets the perimeters as a list of (x,y) coordinates. If you want to know how to use bwboundaries() and plot() to put up the lines in the overlay above the image, just ask.
Don't use contour as the name of your variable since it's the name of a built-in function.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!