Compiling SSIM on Mac
|November 25th, 2014|
If you want to examine the distortion that comes from a lossy compression algorithm, it's helpful to have a tool that's a good proxy for asking a person "how similar are these two images"? The standard algorithm for this is SSIM, but there are several implementations. I was initially using Pornel's
dssim, but I wanted to compare this to Mehdi's
SSIM. Mehdi's doesn't document how to compile it on a mac, so here's what worked for me:
- Install OpenCV
- Download OpenCV for linux/mac. I downloaded 2.4.9 from opencv.org/downloads.
mkdir build && cd build
cmake -G "Unix Makefiles" ..
sudo make install
SSIM.cppfile needs a small change: replace "
#include <iostream.h>" with "
- Compile with:
g++ -I/usr/local/include/opencv \ -L/usr/local/lib/ \ -lopencv_core \ -lopencv_highgui \ -lopencv_imgproc \ SSIM.cpp \ -o ssim
- Enjoy using SSIM:
./ssim a-original.png a-modified.png