I would like to find a Java library that will allow me to search for colours within an image with a tolerance. Preferably quickly. I know how I would do it if I had to write it myself, and it's not super difficult, but I'm hoping to find a library with features other than that principle one. I'd like to be able to also:
- Find another image within an image, with a tolerance, and figure out how closely matched the image is to whatever the function finds
- Specify the manner in which to search for colors or images in an image (such as a outward spiraling manner or whatever)
- Find and return a string containing what it thinks is the text at a particular location in an image
- (trivial) Find colors and images on the display as opposed to an image (I know I could just make an image out of the display, but this would help)
What I really want is SCAR Divi, the program best known for cheating at Runescape, but in Java form so I can use it with my project and I don't feel dirty.
-
The first part of your question is not very easy clear. At any pixel of an image you have a single color, which you can get with BufferedImage.getRGB(x,y). The resulting int contains the RGB values (you need a bit of work to unpack them). You get three 8-bit values in the end: a simplistic (but working) way to compare colors with a tolerance is just to look for the euclidean distance between the two color in the 3D r,g,b space, i.e.
d = ((r1-r2)^2+(g1-g2)^2(b1-b2)^2)^0.5; you will consider "similar" two colors whose d is less than a given threshold.Find another image within an image, with a tolerance, and figure out how closely matched the image is to whatever the function finds
It's quite difficult to do this efficiently: do you want to tolerate distorsions?
Specify the manner in which to search for colors or images in an image (such as a outward spiraling manner or whatever)
What do you mean? This is very unclear.
Find and return a string containing what it thinks is the text at a particular location in an image
You may look for Java OCR libraries for this functionality, but expect good results only on very clean text.
-
ImageMagick is a powerful image processing library which has bindings for many languages. JMagick is the Java flavor.
-
How about Opencv?
0 comments:
Post a Comment