Combine multiple video frames into one using OpenCV

I’m playing a lot with OpenCV and object recognition recently (I started from Python, but now I’ve moved to C++) and what I wanted to do to make my life easier was putting 4 different video frames (original, thresholded, grayscaled & thresholded and original with marked face). Even if it’s not very difficult task, it took me a while to do it, because – definitely – I’m not an OpenCV expert. This article shows how I did it using the new 2.3 (or – actually – 2.X) OpenCV API.

Continue reading

More on swapping two variables without using the third one

No matter what you do, sometimes you just need to swap some values – I guess you did it thousand times. And yes, I know – this problem is trivial. In Python it’s completely trivial. You just swap two variables in the most “natural” way:

1
a, b = b, a

instead of doing it this way:

1
2
3
tmp = a
a = b
b = tmp

Beautiful! This is why we love Python, isn’t it?

That’s the moment where I should end this post, if it was about doing it in a “pythonic” way only. But it’s not – it’s about the ideas, not the solutions in any specific language. So…

Continue reading