Click here to Skip to main content
13,094,742 members (83,083 online)
Rate this:
Please Sign up or sign in to 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 7-Aug-11 21:47pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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......

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 19 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100