OT: Image analysis program

Lately I've been experimenting with some image analysis algorithms, in the context of scraping the Web for images or circuit schematics which are "similar" to a candidate file. I wrote a script in Python and it's kind of fun to play around with! It's a bit hit or miss (computer vision is obviously a very non-trivial field) but it can sometimes return inspired results.

Given the URL

formatting link
and the search string "power amp schematic" it goes off to search Google Images and returns as the top 5:

formatting link
http://www.electronica.ro/audio/la4440_sip14h_sanyo_package.gif
formatting link
formatting link
formatting link

3 out of 5 ain't bad, I guess.

It does better with "easier" test images like:

formatting link

and the search "New York Giants", it returns:

formatting link
formatting link
formatting link
formatting link
formatting link

The source code and Windows command line executable files are available here:

formatting link
if anyone wants to play around.

Reply to
bitrex
Loading thread data ...

I need a circuit that will recognize a yellow sign by the side of the road that says "SPEED RADAR" ;-) ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  |
| E-mail Icon at http://www.analog-innovations.com |    1962     |
             
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

Sounds like the Tin Eye firefox plugin.

I consider it a work in progress. It does find renamed/resized files.

Reply to
miso

I wonder what kind of algorithms they use - bet they won't tell you! I'll share how my script does it, though. It first takes the source and test images, resizes them to be the same size, converts them to greyscale, and runs them through an edge enhance filter. It then cuts the resulting images up to NxN blocks, converts the array of greyscale values into a square matrix, and computes the eigenvalues of each of these matrices.

A weighted sum of the magnitudes of the eigenvalues is computed for each block. The magnitudes of the eigenvalues of the matrix generated directly from the image greyscale values encode information about the image; the large magnitude eigenvalues are the DC component, while the small values are noise. The weighted sum of the middle values encode information about the "texture" or "smoothness" of that section of the image; lower values indicate higher smoothness.

Finally, a multidimensional k-nearest neighbors search is done to find the images whose array of eigenvalues correspond best to the test image.

Of course Tin Eye has to write their own search engine and crawler to implement their algorithms, for this little script I can just rip off Google Images... :)

Reply to
bitrex

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.