필터 지우기
필터 지우기

How to show a gray scale image with its contour in one figure?

조회 수: 4 (최근 30일)
Yaoting Yue
Yaoting Yue 2019년 7월 6일
댓글: Yaoting Yue 2019년 7월 9일
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
1562416539(1).png

답변 (2개)

Nils Speetzen
Nils Speetzen 2019년 7월 6일
Hi,
you should be able to achieve your goal using imfuse like this:
finalimage = imfuse(grayscaleimage, contour, 'blend');
imshow(finalimage)
The blend option uses alpha blending to combine both images.
I hope this works for you.
  댓글 수: 1
Yaoting Yue
Yaoting Yue 2019년 7월 7일
I tried this, it's not work, the colorful contours would become white. I look for other solutions, and finally I make it, this function imoverlay() works it out.
Anyway, thank you very much!

댓글을 달려면 로그인하십시오.


Image Analyst
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
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.
Yaoting Yue
Yaoting Yue 2019년 7월 9일
Thanks a lot! Yeah, After I got the list of (x,y) coordinates by using bwboundaries(), how to use plot() to put up the lines in the overlay above the image?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by