Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

PHP PHP programming, image processing

  1. Jul 11, 2010 #1

    So this is minimally image processing, but I didn't know what else to name this thread.

    I'm working on a project and basically, I have this image (see attached file) thats provided to me. That's all I have to work with. The first column of colored pads represents my test pad. The other colored pads represent the reference pads.

    For each pad in the first column, I need to look across that row via my PHP code and find the reference pad that is closest to it in color.

    I'm working with this in PHP. Does anyone have any clever solutions to this problem?

    Some of the stuff I've been doing thus far is trial and erroring my way to the center of one of the pads and taking it's RGB value and then finding my way to the middle of other colored squares and finding its RGB value and comparing to see which RGB value matches the best.

    Thanks ahead of time for the help.

    Attached Files:

  2. jcsd
  3. Jul 13, 2010 #2
    Although I am not quite sure what "trial and erroring" means in this context, the majority of what you said seems to be how I would attempt this program.
  4. Jul 18, 2010 #3
    Can you post the code up that you have so far?
  5. Jul 18, 2010 #4
  6. Jul 27, 2010 #5
    Hey thanks a lot for everyone's responses! I was actually just testing in PHP (they do have some ability to find the RGB values of pixels in images) because I know PHP a bit better.

    But ultimately, I programmed for an iPhone and so I used Objective C and I used this computer vision library created by Intel called OpenCV. It's a pretty cool library with an array of image processing tools. Just FYI in case you all are ever in need of an all-encompassing image processing archive and you're unaware of this as I was.

    And in terms of figuring out how "close" two colors are to one another, it's better to use a color space known as LaB and not RGB. Although it does depend on how you're defining "how close two colors are:, Lab is supposedly a device independent color space is suppose to match human perception of color the best. Take that for whatever it's worth. But color perception is a pretty involved process to say the least!

    Anyways, I'm rambling but thanks again for the responses!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook