Compiling SSIM on Mac

November 25th, 2014
tech
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:

  1. Install OpenCV
    1. Download OpenCV for linux/mac. I downloaded 2.4.9 from opencv.org/downloads.
    2. unzip ~/Downloads/opencv-2.4.9.zip
    3. cd ~/Downloads/opencv-2.4.9/
    4. mkdir build && cd build
    5. cmake -G "Unix Makefiles" ..
    6. make -j8
    7. sudo make install
  2. Download SSIM.ccp: wget http://mehdi.rabah.free.fr/SSIM/SSIM.cpp
  3. The SSIM.cpp file needs a small change: replace "#include <iostream.h>" with "#include <iostream>".
  4. Compile with:
    g++ -I/usr/local/include/opencv \
        -L/usr/local/lib/ \
        -lopencv_core \
        -lopencv_highgui \
        -lopencv_imgproc \
        SSIM.cpp \
        -o ssim
  5. Enjoy using SSIM: ./ssim a-original.png a-modified.png

Recent posts on blogs I like:

Contra Scott Alexander On Apologies

I really need a short word for "complicatedly in favor of"

via Thing of Things September 12, 2024

Don't Help Kids With Contra Dancing If They Don't Need Help

If you're a kid like me, most kids have probably never heard of contra dancing before. You're probably wondering: contra dance -- what's that? Contra dancing is in some ways similar to square dancing. It's a group dance with a caller and…

via Lily Wise's Blog Posts September 9, 2024

Two 19th-century missionary memoirs in China

Life for an American family in 1860s China The post Two 19th-century missionary memoirs in China appeared first on Otherwise.

via Otherwise August 24, 2024

more     (via openring)