# How can I calculate euclidian distance in RGB spaces for a skin lesion ?

18 ビュー (過去 30 日間)
JovanS 2022 年 9 月 19 日
コメント済み: Image Analyst 2022 年 9 月 23 日
To be clear I want to find The Euclidean distance D which is calculated between each pixel color and the six colors ( white , red, light brown , dark brown , blue gray and black ). I converted the RGB color space to the CIE Labcolor space but I don't know how to continue . I attach my code so far and an image.
##### 1 件のコメント表示非表示 なし
William Rose 2022 年 9 月 19 日
WhenI try to runthe script I get the error
File "color.png" does not exist.

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

### 採用された回答

Image Analyst 2022 年 9 月 22 日
"I want to find the percentage of colour appearance for each one of the six colours (white , red, light brown , dark brown , blue gray and black ).What i have to do?" <== See attached Discriminant Analysis demo. It does exactly that.
##### 2 件のコメント表示非表示 1 件の古いコメント
JovanS 2022 年 9 月 23 日
Ok your code was really helpful but i have some questions in order to understand how it works.
If i have understand how it works i have to enter 6 as the number of classes (each class is for a specific color from the colors above and then when i have to draw the sample pixel colors i have to draw the whole skin lesion in order to find the percentage of colour appearance for each one of the six colours. Right?

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

### その他の回答 (2 件)

Image Analyst 2022 年 9 月 19 日

Use this function: deltaE
You will need to calibrate your images with known color standards, otherwise the delta E you get is totally dependent on the lighting you use and your exposure time. See attached tutorial.
##### 0 件のコメント表示非表示 -1 件の古いコメント

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

William Rose 2022 年 9 月 19 日
Since there is a file missing which I need to run your code, I will just give a few suggesitons.
1. Post the simplest possible example that demonstrates the problem or what you are trying to do.
2. If you want to compute distance between two specific colors in CIE space, use dist=imcolordiff(c1,c2), where c1, c2 are RGB colors.
3. To get a monochrome image whose gray scale values represent color distance (in CIE space) between corresponding pixels of 2 images, use im3=imcolordiff(im1,im2), where im1, im2 are RGB images.
See imcolordiff help for additional options and examples. Good luck.
##### 6 件のコメント表示非表示 5 件の古いコメント
Image Analyst 2022 年 9 月 23 日
You can train it and classify it with a discriminant classifier. See attached demo and adapt as needed.
Or you could use k-nearest neighbors.

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

### カテゴリ

Find more on Color Space Formatting and Conversions in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by