Python Forum
OpenCV - Distinguishing between three icons
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OpenCV - Distinguishing between three icons
#1
Hi,

I have an application that needs to determine when a particular icon is showing:
X
[Image: JTwA9qE.png]

Lakitu
[Image: 9j85n84.png]

Mario
[Image: jHrz06q.png]

One icon will be showing at any given time, the background behind the icon will always be changing. They are displayed in the same location and switch between each other. I need to be able to determine when the icon is displaying the 'X'. Preferably using OpenCV. My current method is using inRange and defining a colour range, then if enough pixels fall within that colour range, I consider the X found. The issue is a lot of the Lakitu falls within the same colour range making it not reliable enough.

The other important point is that many people run this software, and every persons game capture and colours are slightly different so I have to make it lenient enough to work on slightly different colours.

One way I thought of was making it exclude colours from the mask if the green and blue value weren't within a defined range of each other, as the Lakitu doesn't really contain any blue, however the X always has similar blue and green components. I have no clue where to start though.

Thank you!
Reply
#2
Hello,

If you have only three templates, you can use the template matching of OpenCV after get this three template in picture files:

https://docs.opencv.org/3.0-beta/doc/py_...ching.html
Reply
#3
Thanks for the reply!

I just tried template matching, however I don't think it;s reliable enough for my needs. Especially as the quality of the X picture can vary a reasonable amount depending on the person using the program. At times depending on the background behind the X, it only gets me a 50% match, and that's using a template taken from my own video capture, so the results would be worse for someone with a different capture quality.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python icons in Ubuntu KatManDEW 4 63,743 Aug-12-2022, 08:33 AM
Last Post: rob101
  file icons have Firefox icon Ricvourn 4 1,405 Mar-31-2022, 11:40 PM
Last Post: Ricvourn
  Distinguishing different types of class attributes Drone4four 4 2,053 Feb-21-2022, 06:34 PM
Last Post: deanhystad
  Change icons of system rizzla 1 1,879 Jan-28-2021, 03:30 PM
Last Post: Marbelous

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020