Skip to content

A snipping tool that resizes the image intelligently using content aware scaling

Notifications You must be signed in to change notification settings

pohaoc/INTLSnip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

INTLSnip

A snipping tool that resizes the image intelligently using content aware scaling

Why

The inspiration came from cropping images for training data. I wanted a way to avoid squishing image, but still preserve the features.

The tool is implemented with the algorithm described in this paper

GUI built with PyQt5

How does it work?

This application allows users to crop image and decide the percentage of the original size they want to reduce it to while still preserving the prominent features

The algorithm creates a mapping of weights on each pixel by summing the absolute value of the partial derivative of the images in x-axis and y-axis. It is done by convoling against the image with a 3x3 sobel filter

The formula to calculate the weight is

After obtaining the weight mapping, the algorithm finds the minimum path from top to bottom. Remove said path and repeating the same process will result in an image that preserves all the prominent features.

For more information please see this blog.

Example (50% reduction):

Original Processed at 50% size

Potential Uses / Issues

Because the algorithm looks for prominent features in the image, if you were to crop an image of a face and reduce it by 50%. If it thinks the eyes and mouth are more outlined than the shape of face. The resulting picture may make you look like an alien. This may be not be a good thing if you are trying to make an instagram post. However, this could be potentially used in data augmentation for neural networks.

About

A snipping tool that resizes the image intelligently using content aware scaling

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages