Video Compression

VideoNerd

Blending of Two Frames from the Same Scene can help to specify motion displacement.

C++ code BlendFrame.cpp   blends two frames with the weights (0.5, 0.5) . The cpp-file BlendFrame.cpp applies libraries  of OpenCV2.3  and cvAddWeighted function. 

To create and build Visual Studio project (x64, Release) you need install OpenCV 2.3 version and put BlendFrame.cpp as the main file.

If you are reluctant to install OpenCV2.3, you can download it from there   , OpenCV2.3 contains two folders ‘include‘ and ‘libs‘. 

In “Additional Include Directories” of C/C++ section of your Visual Studio project it’s needed to put C:\Tools\OpenCV2.3\include\opencv;C:\Tools\OpenCV2.3\include  (notice that i put OpenCV2.2 under the folder ‘Tools’). In “Additional Libraries Directories” of Linker section it’s needed to put C:\Tools\OpenCV2.3\lib\x64 .

I take h265 file (of Johny video sequence, the scene type – moving head) and extract frame at the very beginning and after 5s

ffmpeg -i Johnny_1280x720_60.h265 -ss 0s -y -frames 1 Johny0s.png

           ffmpeg  -i Johnny_1280x720_60.h265 -ss 5s -y -frames 1 Johny5s.png

 

 

Then i apply Blending.exe of the two frames (sampled at 0s and 5s):

C:\Tools\TestOpenCV\TestOpenCV\x64\Release>Blending.exe    C:\Tools\Johny0s.png      C:\Tools\Johny5s.png

 

Leave a Reply

Your email address will not be published. Required fields are marked *