0

With OpenCV I've written a script that;

  • captures a running application in real-time and displays it in a window
  • searches for a specific image within the window
  • if it finds the image, it draws a box around it otherwise it does nothing

I want to extend this functionality to be able to identify multiple images on the same window at once.

As I understand it I can either:

  • store the images as a list and iterate over the list doing something at each iteration
  • use the same functionality noted above, in a different thread.

What do I need to take into consideration when deciding on the approach? Is there a best practice to follow or things I need to be aware of before deciding on a course?

I've found a number of topics on the subject but they're all very old and mostly deal with sensors or performance or are other languages. It's a 2D image I'm detecting, I don't think performance is going to be an issue.

When is it appropriate to multi-thread?

When to thread and when to WAR?

Python: Multi-threading or Loops?

When multi-threading is a bad idea?

To multi-thread or not to multi-thread!

  • 3
    If performance is not an issue, then you are guilty of the sin called "premature optimization". Firs, make it work. Then, see if it is fast enough. Multithreading in Python is not useful unless you are I/O bound or are able to call into C functions. Otherwise, the global interpreter lock blocks you. – Tim Roberts Mar 09 '21 at 18:38
  • Cheers @TimRoberts that's fair, although I was more so thinking about it from a what makes the sensible approach but that might be too much of it depends. –  Mar 09 '21 at 18:42

0 Answers0