Color Segmentation by Delta E color difference help (manually inputing values)

So wasn't really sure where to ask this, but using the code that Image Analyst has written (guess this is mainly directed towards him), is there a way to input the values for the colors you would like to find manually? Im having trouble finding out how to do this, as I am somewhat new to MATLAB. The reason I ask is because I originally used the code by Image Analyst to find the "orange" color in turtle shells, but since I'm doing it for thousands of images I think it might be better to have a standard set of colors I am looking for rather than drawing a region (which could differ every time). Any help would be very much appreciated, thanks!

 採用された回答

Image Analyst
Image Analyst 2013 年 1 月 29 日
There is a line in the code that says:
% Get the average lab color value.
[LMean, aMean, bMean] = GetMeanLABValues(LChannel, aChannel, bChannel, mask);
It gets the mean L, A, and B color from the mask region you drew. But you don't have to do it that way. You can have some text file with standard LAB values in it and just read those values from the text file if you want.

18 件のコメント

Dimitri
Dimitri 2013 年 1 月 29 日
Could you guide me in how to do that please? I'm still learning how to use MATLAB.
Dimitri
Dimitri 2013 年 1 月 29 日
For example, how do I go about creating this text file or finding one (not really sure what I'm looking for).
Image Analyst
Image Analyst 2013 年 1 月 29 日
You can look at that line and see what values it returns for various turtle shells from your "training set" of images. Perhaps average lots of images together to find the mean LAB over all the images. Knowing these means you can determine the delta E by looking at the range of LAB values you encountered. For example you have a bunch of LAB colors and find that sqrt(deltaL^2+deltaA^2+deltaB^2) is always less than, say, 20 no matter what pair of colors you pick.
Then put the standard/reference lab values you want to compare against into Excel and save as a csv file or workbook. Then read back in with csvread or xlsread.
Dimitri
Dimitri 2013 年 1 月 29 日
Thank you so much for all your help with everything! I'll go ahead and try this now!
Dimitri
Dimitri 2013 年 1 月 29 日
So I have a small problem. When I run the code this is what is outputed for those values.
LMean =
49.3612 26.6750 45.2405
aMean =
{}
bMean =
[49.3612] [26.6750] [45.2405]
For the excel workbook, I put in 49.3612 in the first cell (A1), 26.6750 in (B1), and 45.2405 in (C1).
Heres the line I replaced the previous code with:
[LMean, aMean, bMean] = xlsread('LAB Values.xlsx')
Not sure whats wrong.
Dimitri
Dimitri 2013 年 1 月 29 日
Nevermind, I just input the values directly into the function and it works. Thanks again!
Engineer
Engineer 2013 年 11 月 29 日
Dimitri, I have your same task but I'm not able to deal with "mask". How did you replace it? could you post the code please? thanks! Cheers
You can't do:
[LMean, aMean, bMean] = xlsread('LAB Values.xlsx')
and expect it to give you the contents of Excel cell A1 in LMean, the contents of cell B1 in aMean, and the contents of cell C1 in bMean. That's not how xlsread() works. The first output argument is ALL the numbers in one array. The second is all the strings in a cell array, and the third is the raw results. If you created a spreadsheet with those numbers, you want to do
labMeans = xlsread('LAB Values.xlsx');
LMean = labMeans(1);
aMean = labMeans(2);
bMean = labMeans(3);
hamed abdulaziz
hamed abdulaziz 2014 年 1 月 16 日
How to calculate the delta E as a single value?to use is for edge finding
Image Analyst
Image Analyst 2014 年 1 月 16 日
delta E (the color difference) is equal to sqrt(deltaL^2 + deltaA^2 + deltaB^2).
hamed abdulaziz
hamed abdulaziz 2014 年 1 月 16 日
Ok,I tried this demo on http://www.mathworks.com/matlabcentral/answers/73741#comment_145951 but I got the delta E as a matrix with the double values, can I have delta E as a singl value to give me an indication for edges found;as you (with thanks to you of course)said:"An edge will have a high delta E while non-edges will have low delta E"?
I'm not sure why you'd want to unless you had a really huge image and needed so reduce memory usage, but you can simply do
deltaE = single(deltaE); % Convert to single precision.
hamed abdulaziz
hamed abdulaziz 2014 年 1 月 18 日
Thank you very much,but can I get it as single value(i.e. one value),and if this value was low that means no edge detection else if high then the edge is found.(this correct or not?)
Each pixel has a delta E. Of course you could threshold the image if you want
binaryImage = deltaEimage > someSingleThresholdValue;
If that's not what you meant then you have to be more explicit in describing what you want.
hamed abdulaziz
hamed abdulaziz 2014 年 1 月 18 日
Ok,I have two groups of image,first group contains clear edges,and the second group doesn't have clear edges ,and I have two segmentation algorithms for each Images group so what I want to do: 1-If the image contains edge use the first algoritm else go to the second algorithm,can I do this procedure depending on the value of deltaE?
hamed abdulaziz
hamed abdulaziz 2014 年 1 月 18 日
Dr.Image Analyst: could you guide me?thanks in advance.
Image Analyst
Image Analyst 2014 年 1 月 18 日
I don't know how to guide you. I gave you a full demo that is heavily commented. You just have to replace the file name with yours. If you want any more help then start your own thread, post your code and image, and be more specific about how else you need to adapt the demo to your situation.
hamed abdulaziz
hamed abdulaziz 2014 年 1 月 18 日
Thanks, I will post my question in my own thread

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeNeuroimaging についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by