SkillAgentSearch skills...

Ssim

Program to measure the similarity between two videos using the OpenCV library and the structural similarity algorithm (SSIM). This is modified from the video-input-psnr-ssim tutorial of OpenCV.

Install / Use

/learn @yeokm1/Ssim
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

ssim

Program to measure the similarity between two videos using the OpenCV library and the structural similarity algorithm (SSIM). This is modified from the video-input-psnr-ssim tutorial of OpenCV. This program has been tested to work on the Windows platform only. For the CUDA-optimised version of this program, check out my other project.

##Differences from video-input-psnr-ssim tutorial

  1. Calculate SSIM for each and every frame.
  2. Show overall progress every 50 frames.
  3. Start comparison at different points of both videos.
  4. Optional number of frames to compare. Compares up to the shortest video by default.

##Usage

#ssim reference_video_file test_video_file reference_start_frame test_start_frame [numFramesToCompare]
ssim reference.avi test.avi 0 1
ssim reference.avi test.avi 5 13 1000

##Screenshots

Screen Preview windows are shown to indicate progress.

Screen A percentage result is given at the end.

##Compiling this program

cmake -G "MinGW Makefiles" #First time only
mingw32-make

##Dependencies I used

  1. OpenCV (2.4.9)
  2. Cmake (3.0.1)
  3. Mingw, GCC 4.8.1

###Installing Dependencies

  1. Download and install Mingw. Check the options, "mingw32-base" and "mingw32-gcc-g++". Add "C:\MinGW\bin" to your PATH.

  2. Download and install Cmake for Windows. Choose to add to system path during installation.

  3. Download OpenCV 2.4.9 here from the github releases. Do not use the official Windows binary unless you wish to use Visual Studio to compile your project. Unzip the zip file to C:\opencv.

  4. Open CMake GUI. Set source to C:\opencv and where-to-build to C:\opencv\build\x86\mingw. Click "Configure", select "MingGW Makefiles" and "Default native compilers" then "Generate"

  5. Compile OpenCV using Mingw based on the commands below then add C:\opencv\build\x86\mingw\bin to your PATH.

cd C:\opencv\build\x86\mingw

#Change N in -j to the number of CPU cores you have for parallel compilation. For eg, -j4.
mingw32-make -jN
mingw32-make install
#Do not run "mingw32-make clean"

##References

  1. OpenCV install with Codeblocks and Mingw
  2. Video Input with OpenCV and similarity measurement
View on GitHub
GitHub Stars15
CategoryContent
Updated1y ago
Forks4

Languages

C++

Security Score

75/100

Audited on Mar 1, 2025

No findings