0

I want to "stack" two (or more) videos with the same background, such that it looks like there are two people moving at the same time (not sure if stacking is the right term for that?).

So far, I've tried that using opencv-python, both by summing or averaging the overlapping frames.

The desired effect is there, but I get these weird colors:

enter image description here

Where do these effects come from and how can I avoid them?

1 Answer 1

0

That looks like a case where you get an overflow.

Just doing an addition of two components with a char (or std::uint8_t in C++) will often overflow. I don't know about python implementation and how you've done your add, but just checking whether it's more than 255 if the value is on one byte is not going to work. You need to do the addition in at least a short, average, then save the results.

One way people deal with this issue is by using a float for each pixel. The addition won't break the type and you can easily calculate the average afterward.

1
  • 1
    That solved it, thanks! :)
    – dbantje
    Jul 23, 2021 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.