Page 1 of 1

Auto Trim white objects

Posted: Thu Feb 07, 2013 6:46 am
by mrbombay
Hello,

We have like more then 5000 pictures to trim around picture.

Does anybody have the right settings for this?

Here you have a difficult example from one picture...

Re: Trim white objects

Posted: Thu Feb 07, 2013 8:18 am
by eL_PuSHeR
Do you mean autocrop? ALT-Y

Re: Trim white objects

Posted: Thu Feb 07, 2013 9:01 am
by DOS386
> We have like more then 5000 pictures to trim around picture.

COOL :-)

> Here you have a difficult example from one picture...

I'm getting best results with Tolerance 21 ... but AutoCrop is not smart ... you have to find out the background color (here white, no problem) and the tolerance (big problem: here 27 is too much already) yourself.

Re: Trim white objects

Posted: Mon Feb 11, 2013 11:02 pm
by helmut
Hmm, I wonder whether the background colour could be determined automatically by XnView.

Auto-colour and Auto-tolerance
If a user applies automatic crop, he/she indicates/knows that there is a surrounding background and an object in the image. Otherwise, triggering auto-crop would not make sense.

Given the above assumption, both colour and tolerance could be determined automatically by XnView inspecting all border points of the image. The auto-colour would be the average out of all colours. And the auto-tolerance would be the tolerance found in the colour values of all border pixels.

Applying auto-crop to an image multiple times with auto-colour and auto-tolerance would end up in a mess. To avoid this, reasonable maximum values might help.

Currently, auto-colour and auto-tolerance in auto-crop are not supported. These are just some first thoughts how this might work. Probably much more thinking and even trial-and-error would be needed to make this really fly.

Re: Trim white objects

Posted: Tue Feb 12, 2013 8:04 am
by DOS386
> both colour and tolerance could be determined automatically by XnView

not really

> inspecting all border points of the image. The auto-colour would be the average out of all colours

no problem

> And the auto-tolerance would be the tolerance found in the colour values of all border pixels

This won't work. A few almost invisible dark noise pixels at the border will enforce a high tolerance eating up parts of the valuable image (see above).

> Applying auto-crop to an image multiple times with auto-colour and auto-tolerance
> would end up in a mess. To avoid this, reasonable maximum values might help.

Can't reproduce this.

Re: Trim white objects

Posted: Tue Feb 12, 2013 8:45 pm
by XnTriq
Suggestions: visual batch crop

Content-aware cropping:
Peter Sobot ([url=http://www.petersobot.com/blog/a-use-for-smartphone-photos/]A Use for Smartphone Photos[/url]) wrote:Michael Macias, in a submission to a Codebrawl last November, came up with a brilliantly simple method of content-aware image cropping. By measuring the greyscale entropy of a window as it slides over an image, the highest-interest thumbnail can be determined automatically.

Re: Trim white objects

Posted: Tue Feb 19, 2013 10:40 pm
by helmut
DOS386 wrote:>> And the auto-tolerance would be the tolerance found in the colour values of all border pixels

>This won't work. A few almost invisible dark noise pixels at the border will enforce a high tolerance eating up parts of the valuable image (see above).
Hmm, I can't see why this shouldn't work. If you have dark noise pixels at the border, then auto-crop the way it works now is at a loss anyway, even when setting both colour and tolerance values manually, isn' it?

I'm pretty sure that there is a way to automate this and to achieve a good result for images with a background like the ones shown above.

@XnTriq: Thanks for the links. I had a look at the sample pictures of Michael Macias and found the sample results not overwhelming. Yet, I guess the sample pictures were very difficult for automatic cropping. I assume with above sample image (sport shoe) and similar images the results would be reasonable.

Re: Trim white objects

Posted: Wed Feb 20, 2013 9:30 pm
by XnTriq
helmut wrote:@XnTriq: Thanks for the links. I had a look at the sample pictures of Michael Macias and found the sample results not overwhelming.
Croppola's output of 351044_08.jpg is also disappointing :-|
I'm confident, though, that algorithms for content-aware cropping will eventually be improved.

If the Gamma (Image » Adjust » Brightness/Contrast/Gamma/Balance...) of 351044_08.jpg is decreased, it becomes apparent that the shoe was placed on a turntable. This leads me to the conclusion that all/many of mrbombay's 5K product photos may well have been shot under the same or similar conditions.
Batch-cropping seems to be a viable option in this case.
  • Tools » Batch Processing... » Transformations » Image » Crop
    • X [ 250 ]
      Y [ 150 ]
      Width [ 720 ]
      Height [ 540 ]