Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find logo in desktop screenshot

I need to develop a desktop application which will

1.) have a list of the Different Application logos (Background Transparent) e.g. IE, FIREFOX, CHROME, PHOTOSHOP ETC.

2.) User will take a screenshot of desktop and save the image.

3.) Now my application need to search all the logos in the screenshot image and tell which all logos are present and where.

4.) I used OPENCV, it's working, but when user changes the desktop background & captures screenshot, it's not working as the transparent area of logo is getting the desktop background content.

Can somebody provide a solution or libraries open source, commercial to do this job.

like image 277
Hoshin Avatar asked Jan 26 '11 07:01

Hoshin


People also ask

How to capture an image on my screen?

Press Ctrl + PrtScn keys. The entire screen changes to gray including the open menu. Select Mode, or in earlier versions of Windows, select the arrow next to the New button. Select the kind of snip you want, and then select the area of the screen capture that you want to capture.

How to cut and paste screenshot?

Using the PRINT SCREEN key Pressing PRINT SCREEN captures an image of your entire screen and copies it to the Clipboard in your computer's memory. You can then paste (CTRL+V) the image into a document, email message, or other file.


2 Answers

This is easy to do using cross-correlation.

See my answer to this question.

Basically:

  • Start with desktop image and one template image for each icon
  • Apply edge detection (e.g. Sobel) to the desktop image and template images.
  • Throw away the original desktop image and templates, you won't need them anymore cause we'll be using the edge-detected images
  • For each template
    • Do template matching as you normally would
    • Threshold the maximum of the result. If it's above the threshold, you have a match at that position. Otherwise, no match.

If your icons are aligned in a grid on the desktop, you may be able to speed up your processing by only checking those specific grid positions.

EDIT

You can also save a lot of time by knowing which icons to search for. If you have access to the file system, then just look for *.lnk files (or any other extensions you may be interested in) in the directory that corresponds to the desktop (can't remember exactly what it is, but for Windows7 it's something like c:\users\misha\desktop). That will tell you what icons are there on the desktop. This will allow you to shorten your template candidate list before you go and do the template matching.

like image 197
mpenkov Avatar answered Sep 28 '22 07:09

mpenkov


I like misha's answer and I think it should work for you. But it that doesn't work you could try replacing the transparant pixels in your reference logo with uniformly distributed random noise before trying the match. This will make the transparant pixels irrelevant for any matching computation because they will match just as bad no matter what there is on the desktop in those pixels.

like image 42
jilles de wit Avatar answered Sep 28 '22 07:09

jilles de wit