Filter löschen
Filter löschen

How to overlay the contour map on its corresponding original image?

4 Ansichten (letzte 30 Tage)
Zong Shenyan
Zong Shenyan am 22 Apr. 2020
Beantwortet: Ameer Hamza am 22 Apr. 2020
Hi All,
I knew the function 'contour' could plot contour map for a 2D matrix. I have used it and successfully shown the contour map of that matrix as I expect. However, I want to show the contour map and the original image at one coordinate, then I could see how the contour lines as the threshold segment the original map. Could someone tell me how to finish this work?
Best regards,
Shenyan.

Antworten (1)

Ameer Hamza
Ameer Hamza am 22 Apr. 2020
See this example
im = im2double(imread('pears.png'));
im_gray = rgb2gray(im);
figure();
ax = axes();
I = imshow(im, 'Parent', ax);
hold on
c = contour(ax, im_gray);

Community Treasure Hunt

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

Start Hunting!

Translated by