Color Detection Algorithm - Page 3
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 3 FirstFirst 123
Results 31 to 39 of 39

Thread: Color Detection Algorithm

  1. #31
    Join Date
    Nov 2007
    Posts
    27

    Re: Color Detection Algorithm

    It is good enough already for me. In order to make it auto, it is my job anyway. Thanks.

  2. #32
    Join Date
    Aug 2010
    Posts
    3

    Re: Color Detection Algorithm

    anyone know how to recognize skin color in java~ do help me~very urgent~

  3. #33
    Join Date
    Jun 2010
    Posts
    115

    Re: Color Detection Algorithm

    human skin color is defined within some ranges ?
    R belongsto [a,b]
    G belongsto [c,d]
    B belongsto [e,f]
    Foreach pixel of a given image, getpixel return a value [0,255]
    What's wrong with this method ?

  4. #34
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,594

    Re: Color Detection Algorithm

    Quote Originally Posted by Maejie View Post
    human skin color is defined within some ranges ?
    R belongsto [a,b]
    G belongsto [c,d]
    B belongsto [e,f]
    Foreach pixel of a given image, getpixel return a value [0,255]
    What's wrong with this method ?
    The HSI color model much better resembles human perception than the RGB model. Just read the earlier posts in this thread to learn something about it.

  5. #35
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,594

    Re: Color Detection Algorithm

    Quote Originally Posted by juana View Post
    anyone know how to recognize skin color in java~ do help me~very urgent~
    Now, more than one week after your post, I'd like to mention that when I pointed you to this thread, I meant you should read it rather than post in it. Considering the age of the thread, I think it's unlikely that the members who wrote it are still monitoring it, at least not on a regular basis.

    Didn't reading the thread give you any useful information?
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  6. #36
    Join Date
    Oct 2010
    Posts
    1

    Re: Color Detection Algorithm

    i need to find two colors in an image : red and white regions such that the two colored regions are adjacent. Also is it possible to put bounding boxes around the above specified regions? thankyou

  7. #37
    Join Date
    Oct 2010
    Posts
    15

    Re: Color Detection Algorithm

    Just use the code posted in this thread to discriminate between the two regions as black and white. Then go through all the pixels, and identify border pixels -- they are the ones that aren't surrounded by same-color pixels. At the same time group all border pixels that are adjacent to each other together, and you'll have a list of groups of pixels which is a list of outlines around each region.

  8. #38
    Join Date
    Oct 2010
    Posts
    5

    Re: Color Detection Algorithm

    I know this is an old thread and the topic seems to have shifted a little from the original question... but as I'm about to ask a question myself, I thought I'd just to go back to the original question in this thread ("How can I find the green pixels in my image?") as I didn't see a few possibly relevant things touched on in here and contribute first.

    There's actually three things at play..
    1. The method of determining which colors are green
    2. Specifying what, exactly, 'green' is.
    3. What color system you're using (ignoring that one in this post)
    Is #00ff00 green?
    What about #00cc00?

    If you're looking just for those 'pure green' colors, then a bitmask will do.

    Is #10ff00 green?
    If you're looking for colors that are close enough to a pure green, then a hue lookup (either through conversion to HSV/HSL or not) with a threshold will do.

    Now for a less simple example...
    Is #8db600 or is #27a64c green (#00ff00)?
    Conventional wisdom from looking at the numbers would indicate that the first is more of a yellow and the second is more of a green.
    Looking at the hues for the first one, it is 73.5°.
    For the second one, 137.5°.
    In terms of hue, the second one -also- appears to be more green (120&#176, while the first appears to be quite a bit more yellow (60&#176.
    Yet if you put all three colors up on your screen, odds are you'll find the first one to match the pure bright green more than the second one.

    The reason for this is that human perception doesn't work like HSV/HSL space - it also doesn't work particularly like L*a*b space when it comes to comparing two colors (where one might take the euclidean distance).
    It's actually a question that is answered ever-refinedly and the algorithms that try to give the answers in color difference are all shared under the nomer "Delta E".
    http://en.wikipedia.org/Color_difference

    Once you implement any of those algorithms (I suggest CMC 1:1 - it's fairly accurate without the heavy calculation and coding impact of CIEDE2000), you'll also quickly find that while both #00ff00 and #008000 are green, the range of similar colors varies wildly between these two along traditional hue axes and the like.. so you have to specify what 'green' is for such an algorithm to tell you what other colors in the image are similar to that 'green'.

  9. #39
    Join Date
    Sep 2012
    Posts
    1

    Re: Color Detection Algorithm

    I have used nearest neighbor classification in l*a*b space color in order to separate Blue object and Green object in an image.
    Classification give me two RGB images.I want to detect which one is blue and which one is Green.
    I wrote this code in matlab:

    [y1 y2]=classify_im(RGBimage); %This function return two RGB images after classification

    if (mean(mean(y1(:,:,2))) > mean(mean(y1(:,:,3)))) && (mean(mean(y1(:,:,2))) > mean(mean(y2(:,:,2))))
    GClass=y1;
    BClass=y2;
    else
    GClass=y2;
    BClass=y1;
    end

    But In some condition, it does not detect correctly...
    Can anyone help me?
    thanks

Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center