Matlab: filled outline graph with imcontour

I am trying to create a filled outline graph from an image in MATLAB. However, the imcontour command does not seem to have an option for filled outlines. If I use contourf , it draws all the contour lines in black. Since the image has many levels of contour, it is shown almost entirely in black.

Does anyone know how to make a filled imcontour or how to meaningfully apply contourf on an image?

+1
source share
1 answer

There is no filled version of imcontour , because theoretically the image itself is a filled version.

 data = load('clown'); img = ind2rgb(data.X, data.map); imshow(img); hold on imcontour(img(:,:,1), 3); 

enter image description here

You can use contourf , but specify the color of the line . By specifying a value of 'none' , rows will not be displayed.

 c = contourf(data, 2, 'LineColor', 'none') 

enter image description here

+3
source

Source: https://habr.com/ru/post/1268862/


All Articles