Use contourc to calculate the path and patch to draw it as a filled area.
Following your (prettified;) code
Img = imread('peppers.png'); [Height, Width] = size(Img); [xx, yy] = meshgrid(1 : Width, 1 : Height); imagesc(Img,[0 255]) axis off title('FillColorContour') phi1 = (sqrt(((xx - 60).^2 + (yy - 100).^2 )) - 15);
calculate contour
cont = contourc(phi1, [0 0])'; cont = cont(2 : end, :); % first line contains contour level and number of points; skip
and draw it as a βpatchβ:
patch(cont(:, 1), cont(:, 2), 'r', 'EdgeColor', 'w')
You can choose the fill color and edge color separately; I used red and white.
Result:

For phi2 , of course, you just need similar code.
source share