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

조회 수: 15 (최근 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이전 댓글 -1개 표시이전 댓글 -1개 숨기기
William Rose 2022년 9월 19일
WhenI try to runthe script I get the error
Error using imread (line 349)
File "color.png" does not exist.
Error in xromadik (line 32)

댓글을 달려면 로그인하십시오.

### 채택된 답변

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없음 표시없음 숨기기
William Rose 2022년 9월 22일
@Image Analyst, amazing.
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일
편집: 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이전 댓글 -2개 표시이전 댓글 -2개 숨기기

댓글을 달려면 로그인하십시오.

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이전 댓글 4개 표시이전 댓글 4개 숨기기
JovanS 2022년 9월 22일
I do not have a system or camera to calibrate, I just have two already taken images and 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? @Image Analyst
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.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Recognition, Object Detection, and Semantic Segmentation에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by