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!
ohh and the link to the his code is: http://www.mathworks.com/matlabcentral/fileexchange/31118-color-segmentation-by-delta-e-color-difference/content/DeltaE.m
採用された回答
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 件のコメント
Could you guide me in how to do that please? I'm still learning how to use MATLAB.
For example, how do I go about creating this text file or finding one (not really sure what I'm looking for).
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.
Thank you so much for all your help with everything! I'll go ahead and try this now!
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.
Nevermind, I just input the values directly into the function and it works. Thanks again!
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);
How to calculate the delta E as a single value?to use is for edge finding
delta E (the color difference) is equal to sqrt(deltaL^2 + deltaA^2 + deltaB^2).
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.
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.
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?
Dr.Image Analyst: could you guide me?thanks in advance.
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.
Thanks, I will post my question in my own thread
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Neuroimaging についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
