Matlab如何将边缘轮廓分割着色

img


如同像这样 将边缘不同的曲线着上不同的颜色
目前只能将整个边缘着上一种颜色

c=imread("Pic1_1轮廓图.png");
figure,imshow(c);
a = c(:,:,1);
b = c(:,:,2);
d = c(:,:,3);
index = find(a<20 & b<20 & d<20);
a(index) = 0;
b(index) = 0;
d(index) = 255;
e(:,:,1) = a;
e(:,:,2) = b;
e(:,:,3) = d;
figure,imshow(e)

请问应该如何改进,或者什么样的代码能够实现