Script to Identify product Cut-Out Photos required

Do you need consulting from ImageMagick experts and are willing to pay for their expertise? Or are you well versed in ImageMagick and offer paid consulting? If so, post here otherwise post elsewhere for free assistance.
Post Reply
derridian
Posts: 2
Joined: 2015-06-23T07:29:42-07:00
Authentication code: 6789

Script to Identify product Cut-Out Photos required

Post 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.
derridian
Posts: 2
Joined: 2015-06-23T07:29:42-07:00
Authentication code: 6789

Re: Script to Identify product Cut-Out Photos required

Post by derridian »

Sorry forgot to add - Were running on the LAMP stack and happy to pay $ for the right solution...
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Script to Identify product Cut-Out Photos required

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply