PHP programming, image processing

In summary, this person is trying to figure out how to process an image that has a set of colored pads that represent the reference pads. They are using different programming languages and libraries to try and find the reference pad that is closest to the test pad in color.
  • #1
eprparadox
138
2
Hello!


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) that's 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.
 

Attachments

  • CroppedPic_320.png
    CroppedPic_320.png
    17.3 KB · Views: 531
Technology news on Phys.org
  • #2
eprparadox said:
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.

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.
 
  • #3
Can you post the code up that you have so far?
 
  • #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!
 

Related to PHP programming, image processing

1. What is PHP programming language?

PHP is a server-side scripting language used for creating dynamic and interactive web pages. It is widely used for web development and is known for its simplicity, flexibility, and compatibility with various databases.

2. How does PHP handle image processing?

PHP has built-in functions and libraries for processing and manipulating images. These functions allow developers to resize, crop, rotate, and apply various filters to images. PHP also supports various image formats such as JPEG, PNG, and GIF.

3. Can PHP be used for advanced image processing tasks?

Yes, PHP has advanced libraries such as GD and Imagick that allow for more complex image processing tasks such as image compression, creating thumbnails, and adding watermarks. These libraries also support advanced image formats like SVG and WebP.

4. Is PHP suitable for real-time image processing?

No, PHP is not suitable for real-time image processing as it is a server-side language and requires a page refresh for any changes to take effect. Real-time image processing is better suited for client-side languages like JavaScript.

5. Are there any security concerns with PHP image processing?

As with any web development, there are security concerns with PHP image processing. It is important to properly validate and sanitize user-inputted data to prevent any malicious attacks such as cross-site scripting (XSS) or SQL injections. It is also recommended to use secure image upload methods to prevent potential vulnerabilities.

Similar threads

  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
8
Views
1K
  • Introductory Physics Homework Help
Replies
6
Views
818
  • Programming and Computer Science
Replies
6
Views
6K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
8
Views
5K
  • Programming and Computer Science
Replies
22
Views
1K
Replies
27
Views
3K
  • Programming and Computer Science
Replies
11
Views
859
Replies
8
Views
3K
Back
Top