Page 1 of 1

Script to Identify product Cut-Out Photos required

Posted: 2015-06-23T07:38:22-07:00
by derridian
Overview of Imagick Requirement.

We operate an image library

The pictures we carry are either:
a) Product cut-out Shots on a white or off-white background
b) Normal photographs with depth for Campaign Images, Model Images or Lifestyle shots.


We want to create a simple image search filter that allows the user to select

a) Product cut-outs Images
b) By definition everything else that is NOT a cutout. e.g. Normal Photos with a
background etc.

The challenge is to automate this process and make this at least 95% accurate automatically.

WE are NOT looking to have imagick automate the cut-out procedure, or cut the image
out. All we are doing is running an algorithm that reliably detects “is this image a cut-out or
a regular photo with a background.”

When we have set-up Imagick to search for a proportion of white background, that will
typically pick out the cut-out but will also pick out, incorrectly photographs, that are
campaign shots with depth, that are mistaken for cut-outs.

IF we can improve the algorithm to 95+% then we can manually fix these tricky ones quite easily.
the issue is that we are dealing with thousands of images a day... So its a large
volume to process.

If anyone has any ideas, existing scripts, or can custom write one, we'd be grateful to hear from you.

Re: Script to Identify product Cut-Out Photos required

Posted: 2015-06-23T07:41:25-07:00
by derridian
Sorry forgot to add - Were running on the LAMP stack and happy to pay $ for the right solution...

Re: Script to Identify product Cut-Out Photos required

Posted: 2015-06-23T08:06:46-07:00
by snibgo
The following gives the proportion of pixels that are within 5% of pure white. Depending on your product shots, you might need to increase "5%", or perhaps a smaller number will work. If a smaller number works, it will give fewer false positives. The result is between 0.0 (no pixels are close to white) and 1.0 (all pixels are close to white).

Code: Select all

convert in.tiff -fill black -fuzz 5% +opaque white -format %[fx:mean] info:
Run this over some sample images. Perhaps results more than 0.1 (ie more than 10% of the pixels are close to white) defines images that are product shots.

Code: Select all

convert in.tiff -fill black -fuzz 5% +opaque white -format %[fx:mean>0.1?999:0] info:
This returns 999 for products, 0 for non-products.