Click here to Skip to main content
11,641,081 members (60,493 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Matlab
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
good
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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

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

  Print Answers RSS
0 Mika Wendelius 400
1 OriginalGriff 205
2 DamithSL 203
3 CPallini 145
4 Afzaal Ahmad Zeeshan 129
0 Mika Wendelius 380
1 OriginalGriff 205
2 DamithSL 203
3 CPallini 125
4 Afzaal Ahmad Zeeshan 89


Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 19 Jul 2012
Copyright © CodeProject, 1999-2015
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