PDA

View Full Version : Find pixmap in pixmap



mizim
6th August 2012, 23:42
First of all sorry for my english mistakes.

I am new to QT and got the next goal that has not yet found the way to do it:
Finding a pixmap within another pixmap , or QImage within QImage.
For you to better understand if and how the image was a pixmap of a window, and the other was the pixmap print the full desktop screen and then find the function in the desktop window and return the coordinates.

Any help will be very welcome, I need an idea of ​​where to seek this solution.
Thank you.

high_flyer
7th August 2012, 09:10
What do you mean by "Pixmap within a pixmap"?
How did you achieve that nested pixmap?

mizim
7th August 2012, 16:04
It is well friend, I have a pixmap1 with the image of a window, and I have another pixmap2 with the image of the work area complete with a window contained in it, so I want and that is found pixmap1 in pixmap2 and I get the position x , where y is found.
Thanks for helping me!

ChrisW67
7th August 2012, 23:21
I cannot see any trivial out-of-the-box way to do this, even for images that are perfectly lossless (forget it if you have lossy images like JPEGs). Pure brute force. You have to scan the containing image pixel-by-pixel for pixels matching the top-left pixel of the contained image. Once you have found a possible matching location you have to check the other pixels of the containing and contained images. As soon as a pixel no longer matches you can skip to the next possible top-left match.

If these images are screen shots then the title bars and window borders, which are consistent, will cause the simple approach above to be inefficient because of many false positive matches. You may be better off checking pixels inside the images away from the borders.

You might be able to improve efficiency with an image analogue to the Boyer-Moore string search algorithm.

If the contained image is not arbitrary, e.g. a yellow circle, then this (http://stackoverflow.com/questions/4720168/image-in-image-algorithm) might be of interest. OpenCV may be of use.

high_flyer
8th August 2012, 11:29
As ChrisW67 mentioned, this issue is data analysis and/or pattern matching, it is not a Qt issue - libs dealing with such stuff as OpenCV are what you are looking for.