How do you plot a line on a function defined by colors?

Hello, I want to plot a line on a color defined function (enclosed example below), such that the line follows the boarders between colors. I don't want to plot a line that roughly follows the color boarders but follows the boarder exactly based on the change in color. However, I am unsure how to acomplish this. Any help appreciated.
Example:

3 件のコメント

Walter Roberson
Walter Roberson 2023 年 10 月 19 日
Is that a contourf() output? Or is it an imagesc() or imshow() ? or a pcolor() ?
Does the underlying data have sharp data boundaries, or is the underlying data continuous ?
Lulu
Lulu 2023 年 10 月 19 日
It is an imagesc(). The underlying data has sharp data boudaries.
Dyuman Joshi
Dyuman Joshi 2023 年 10 月 19 日
Could you attach the data? Use the paperclip button to attach.

サインインしてコメントする。

回答 (3 件)

Voss
Voss 2023 年 10 月 19 日

0 投票

img = imread('image.png');
imagesc(img)
hold on
contour(mean(img,3),'k')
Walter Roberson
Walter Roberson 2023 年 10 月 19 日

0 投票

levels = unique(YourData);
contourf(YourData, levels);

カテゴリ

製品

リリース

R2019b

質問済み:

2023 年 10 月 19 日

回答済み:

2023 年 10 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by