7

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.

Hoshin
  • 454
  • 3
  • 14
  • 2
    If you are merely trying to find all the running programs, looking for a logo in a screenshot might not be the best approach... – SWeko Jan 26 '11 at 07:29
  • The requirement is not to find all running programs, instead to find whether x app icon is present on desktop or not, if yes at what position. – Hoshin Jan 26 '11 at 07:33

3 Answers3

8

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.

Community
  • 1
  • 1
mpenkov
  • 21,621
  • 10
  • 84
  • 126
  • Icon can be hollow in some of the areas (so no edges in that area) , in this case the edge image of the desktop image ( as background is changing ) will contain extra edges, how the normal template matching will cope up with this. – Hoshin Jan 26 '11 at 10:00
  • 1
    It will cope just fine, because your template will also have a hollow part. Try it for yourself. – mpenkov Jan 26 '11 at 10:14
2

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.

Community
  • 1
  • 1
jilles de wit
  • 7,060
  • 3
  • 26
  • 50
0

I'm not familiar with the tools you're using, but I'm guessing you have to either:

a) Tell your program to ignore transparent pixels in the icon images during the comparison operation.

OR

b) Tell your program to treat transparent pixels in the icon images as "wildcards" which can be any color.

jeffszusz
  • 435
  • 2
  • 7
  • You are right. But i am looking for some algorithms for fast template matching with region capabilities. If i write myself and check each image block, it will be too much time consuming. Opencv is taking around 10-20 ms for finding one logo in a desktop image. – Hoshin Jan 26 '11 at 07:34