How could I detect color?
2 ビュー (過去 30 日間)
古いコメントを表示
I used this code to detect the color of circles but the code gives me a wrong color. Could you help me how to fix the mistake here. I think I have something wrong with adjusting the background of the images, but I am not sure.
if true
k = 1 : numberOfBlobs % for each microbeads
tempcolor=round(centroidsAll(k,:));
%cycle 1 color
BackgroundR=mean(mean(CropCycl1Ajust(:,:,1))); BackgroundG=mean(mean(CropCycl1Ajust(:,:,2)));
Cycl1ColorR=mean(mean(CropCycl1Ajust(round(tempcolor(1,1)-radius):round(tempcolor(1,1)+radius),round(tempcolor(1,2)-radius):round(tempcolor(1,2)+radius),1))); %%%Red colors
Cycl1ColorG=mean(mean(CropCycl1Ajust(round(tempcolor(1,1)-radius):round(tempcolor(1,1)+radius),round(tempcolor(1,2)-radius):round(tempcolor(1,2)+radius),2))); %%%Green colors
%set a threshould of 20%. Higher: the color of the microbead
if Cycl1ColorR > BackgroundR*1.2
color(k,1)='Red';
else if Cycl1ColorG > BackgroundG*1.2
color(k,1)='Green';
else
color(k,1)='missing';
end
end
ColorMatrix(k,1)=color(k,1);
end
2 件のコメント
Image Analyst
2018 年 9 月 22 日
We don't have enough to run your code, like the image or how you segmented the blobs out!
In the meantime, see my color segmentation demos: https://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Blue についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!