How could I detect color?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Image Analyst
il 22 Set 2018
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
Risposte (0)
Vedere anche
Categorie
Scopri di più su Feature Detection and Extraction in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!