some ideas / options:
- how large is the image ? running a cascade classifier on a 4k image must be slow, less pixels, faster processing, – try to resize the image to something smaller.
- if you absolutely have to use cascades, at least use proper minSize, maxSize arguments, so it will drop a couple of (unneeded) image pyramids
- don’t use cascades. there are a lot of faster alternatives for face detection, like pico, or opencv’s dnn based object detection(yes, there’s a network for that).
- throw out the Thread. as it is now, it’s not doing anything useful. naive attempts at multithreading can only do harm