Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I am trying to detect colors in a color jpeg image. The image has white (almost) background with some colored lines on it. Till now what i have done is to read the image and get the RGB values in vectors. To detect a certain color on the image, first I open the image using imshow, pick some pixels of colors I am interested in and note down their RGB values in a file (lets say RGB.dat). I read this file and find mean and standard deviation for RGB.

Now I read one pixel at a time from the original image and save the pixed location where the RGB values are within a certain tolerance level of the ones I picked manually saved in RGB.dat

I tried to do this on a couple of pictures and it works ok. But for both these pictures I actually had to create RGB.dat manually. Problem is I have around 500-600 pictures to go through and each one of them might have 1-8 colors that I want to detect !!! Is there a way to actually automate this in some way which doesn't require me to go through every picture before I do the color detection.

Thanks a ton.
Posted

NO because you "pick some pixels of colors I am interested". you need to have basis on how you selected that color in order to automate it...if your selecting a random color then put your matlab function in a loop and iterate the file name to get 600 different RGB.dat or creating a matrix to hold those instead of a file.
 
Share this answer
 
Hey........
I also need the same color... I have to detect different colors in squrr or circle or lines of different color........ The code should detect n number of colors.. Plelase help me and send me code......
I started with the concept of masking but it can detect only four colors.
I found your idea of loop pretty cool... But i don't know how to start it......
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900