BlurDetect DevLog — Day 1

BlurDetect is an Adobe Lightroom extension that allows you to discard all blurry photos from your catalogue during import. Follow along at https://github.com/jchau623/BlurDetect.

Start of the project.

I’ve completed the method of detecting blurriness of an image. I used the variance of the Laplacian function to produce a score on how blurry or sharp an image is. The higher the variance, the “sharper” it is. I’ve found it doesn’t work very well as-is.

Score: 457.146 (DNG), 396.7 (JPG)
Score: 93.78 (RAW), 192.46 (JPG)

The script performs slightly better when performed on JPEG images rather than Adobe DNG (RAW) files.

Next step is to normalize image brightness and contrast and observe how it affects the score. Hopefully it will improve accuracy. Although I can’t see how it could help lower the score for the first photo, as increasing brightness and contrast (which would be the effect of normalizing on that photo) should raise the score.

Normalizing contrast would improve the “sharpness” score of the photo, which may have been improperly discarded without this step. (Cr: Wikipedia)

Another issue is how to integrate Python scripts into Lua. Lightroom plugins are written in Lua, and the work I have so far is written in Python. There exists (existed?) a Lua->Python bridge called lunatic-python but pip couldn’t find the package. An alternative is to call os.execute in Lua, but as I intend on processing images as they are imported, possibly thousands, I’m concerned about the performance hit of having to load the python script each time I load in a new image. Unfortunately I couldn’t find a way to import RAW photos in Lua — otherwise OpenCV is available on Lua too.

Like what you read? Give Justin Chau a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.