# Best way to find an object in a picture

I'm trying to find an object in a picture, my solution is to take the picture and a photo of the object and find the maximum of the mutual covariance, this is my project on GitHub: ImageFinder

It works but if the object is rotated or transformed it doesn't work well. Which other method should I use?

I thought that a good way can be to look for the object through the colors and then try to rotate the image or to resize it while does not match, but this idea need an improvement.

## 1 Answer

There is no "best method", it will vary according to application. There are many trains of thought regarding this subject.

I've done something in that area using Cepstral Analysis. Take a look at this:

https://8b14d84720d60d831e70ec440417feb774595227-www.googledrive.com/host/0B4-fFSwiy1mGdS00SHB2Nlo3bkU/imreg_translation/imreg_translation.html

Note: I am the author of the above.

Basically, you do the following:

1. Sum the target image and the object
2. Calculate the Cepstrum of said sum.
3. Find the peaks (there will be 2, you have to resolve the ambiguity using something like SAD)
4. The location of the peak will tell you the translation you must apply to the image.

I based it off this article: http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6128658&tag=1

I'm actually in the middle of creating a barcode (1D and 2D) open-source program using this kind of processing. The link to my bitbucket acount is here: https://bitbucket.org/DSevero/

Although the repo is private for now, I should be releasing a first version around January

:)

• Look at the post update, I've loaded on github my solution, but I need a way that works also if the image is rotated. – Andrea Nov 16 '15 at 21:33
• Look at the article I referenced. It has the math relative to the method. The method is invariant to rotation. – Daniel Severo Nov 16 '15 at 22:26