jterrace / pyssim

A Python module for computing the Structural Similarity Image Metric (SSIM)
MIT License
339 stars 62 forks source link

Implemented an optimization in SSIM.ssim_value. #10

Closed digitizdat closed 9 years ago

digitizdat commented 9 years ago

When comparing many images against many other images, it can save a lot of time to cache SSIM objects. With that in mind I've modified the SSIM.ssim_value() method to recognize when it is passed an SSIM object rather than a regular PIL Image object, and in that case skip the process of building a new SSIM object for it. Now to compare an image to another one that already has an SSIM object created for it, we just pass the img1 member of the second SSIM object to the ssim_value method of the first SSIM object.

The code makes sure that not only is the object passed into ssim_value an SSIM object, but also that the kernel used to create it is the same as the current object.

jterrace commented 9 years ago

Please also add yourself to the AUTHORS file.

digitizdat commented 9 years ago

Well, that took more commits that I would like to admit, but it passes all the Travis tests for 2.7 now. I can't tell why it's not passing for 3.2. Have you seen this before?

jterrace commented 9 years ago

Thanks for your contribution!

digitizdat commented 9 years ago

Gladly! Thanks for writing such a useful module!