Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

colour image processing

Status
Not open for further replies.

annna

Member level 2
Joined
Jun 17, 2010
Messages
52
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
pak
Activity points
1,682
I am using matlab to do Image processing. Actually, I have to process only four images, in three of them I have only to detect that which colour (red, green, yellow) is present in the image. In the fourth image, there will be three dots (red, green, yellow) and I will have to check which one is on left, in centre and on right.... Hope I described what I want to do........... Need imediate help......... Hoping to get my answer here.............
 

Hi;
As i understand, if your images are pure artificial images (i mean in red picture there is only red color, no any other color component) then when you read image in Matlab you have an image mxnx3 where 3 is color components r,g,b. The non zero matrix layer gives your color on the image. (this is for first 3 of them). In the fourth one you should find the index of non zero elements in the each color component matrix. It will give you the position info of the color dot. This a little bit more tricky.
hope it helps
 
  • Like
Reactions: annna

    annna

    Points: 2
    Helpful Answer Positive Rating
Ok the above tricks work good with images having pure red green and blue colors but how can I find color in an image which I have taken from a webcam........
 

May be you can use a color space conversion ie HSV may help you (have a google on it). H stands for hue and defines the angle fo the color in a cylindrical surface. You can define some regions on it. ie. if it s is between 0deg and 30deg then accept it as red etc...
 

hi, i have recently completed a project on image processing in VB, so i hope i can interpret and provide you a solution.
the above method is a bit complicated as also, it requires understanding of the HSI colour space.

what you can do is extract R,G,and B components from the image using following code..(VB)
For x1 = 1 To wt
For y1 = 1 To ht
pixel(x1, y1) = Picture1.Point(x1, y1)
red = pixel(x1, y1) And &HFF
green = ((pixel(x1, y1) And &HFF00) / &H100) Mod &H100
blue = ((pixel(x1, y1) And &HFF0000) / &H10000) Mod &H100

next y
next x

remember that an image which has maximum red component will have the "average of red components of all pixels" higher than the green and blue averages of the same image..

so you can take average of red, blue green values of each pixel and decide by comparing the three which one is greater.

Also if you use MATLAB then the process becomes much simpler using 'impixel' function ...read matlab help for further info...here also the approach remains same.

Pls reply if this technique works as , i am also working on improving my image processing skills. or suggest a new technique.
 
  • Like
Reactions: annna

    annna

    Points: 2
    Helpful Answer Positive Rating
Yeah that technique works for me............... It was real good with red blue and green color detection but there were some problems with yellow color but I managed it.......... Thanks
 

Yeah that technique works for me............... It was real good with red blue and green color detection but there were some problems with yellow color but I managed it.......... Thanks

Thnx for the reply,

btw for the yellow color, i think u would have considered the combination of blue and green averages divided by 255..i hope so.

anyways glad i could be of some help

pass on the good knowledge..however slight it may be..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top