# Content aware cropping



## NYBG (Aug 15, 2011)

This is not specifically a Lightroom question, but I figure someone here might be able to point me in the right direction.

I am photographing lichen specimens that are stored in small paper packets affixed to one large sheet of paper - like this:




There are about 300,000 of these specimens. I would like one specimen per image, and I figure the easiest way (so that I don't have to reposition the specimen in the frame each time) is to shoot them with the extraneous data covered up, like this:



But this is a big waste of digital real estate, and I have to FTP these files to a central site.

Does anyone know of a program that does content-aware cropping?

Thanks in advance.

-Mike


----------



## erro (Aug 15, 2011)

In Photoshop you can (at least could with older versions) let it automatically split up multiple parts of a scanned image. Its purpose is to let you scan several smaller photos at once and then split them into several individual images.


----------



## Victoria Bampton (Aug 15, 2011)

I don't think I'd even cover it up.  I'd photograph one shot with all 8 specimens, and create 7 more virtual copies.  Once I had a whole heap of sets of images, I'd crop each of the virtual copies (top left, top right, middle left, middle right, etc.) and then sync across to the other sets too.


----------



## MarkNicholas (Aug 16, 2011)

Victoria Bampton said:


> I don't think I'd even cover it up.  I'd photograph one shot with all 8 specimens, and create 7 more virtual copies.  Once I had a whole heap of sets of images, I'd crop each of the virtual copies (top left, top right, middle left, middle right, etc.) and then sync across to the other sets too.



That is exactly what I did with my scanned photos. It helps if all the photos are the same size and orientation. Unfortunately mine were a right old mixture and I needed to adjust the crop.


----------



## James_N (Aug 16, 2011)

While you've had some excellent suggestions for using Lightroom, I'd strongly suggest using the Crop and Straighten feature in Photoshop as suggested earlier.  In my opinion its much more efficient since it will automatically recognize image borders and generally requires no manual intervention if the image background provides sufficient contrast.

The additional advantage too is that you can record the Crop and Straighten command in an action, then using the Photoshop Image Processor to run the action targeting a folder containing 37,500 scanned files and it will churn out 300,000 individual images.

See this tutorial from Kelby Training:  http://www.youtube.com/watch?v=07V8Xrf9yuI






NYBG said:


> This is not specifically a Lightroom question, but I figure someone here might be able to point me in the right direction.
> 
> I am photographing lichen specimens that are stored in small paper packets affixed to one large sheet of paper - like this:
> 
> ...


----------



## NYBG (Aug 16, 2011)

*Thanks to all. Automatic?*

Thanks for all the tips! But, I think I need to provide a little more background.

We (I know I said "I" before, that was an over-simplification) will be shooting over 300,000 of these images, so I really would like to find a completely automatic system. The money for this project comes from a grant and it does not cover labor for this task. I (me, this time) simply do not have the time or resources to crop the images manually.

The reason for covering the other labels is that the images will be sent to a central processing facility where they will be OCR'd. The data is being used in some huge database of mosses and crusts (don't ask me why, I'm not a scientist). In absence of cropping, we could cover extraneous information so as not to confuse the automated OCR system.

We would like to avoid having to send the entire image area in order to reduce bandwidth. Covering the image may help OCR, but if we have to send that much blank paper, we're just burning internets. 

So, I am still looking for a content aware, fully automatic cropping solution. I know that Epson scanner software does some sort of content finding when you run a preview scan. If anyone knows anything like this for post-capture images, it would be greatly appreciated.

Thanks again for all the feedback-

Mike
NYBG
www.digitalphotorepro.blogspot.com


----------



## erro (Aug 16, 2011)

What about James (and mine) suggestion above: Crop and Straighten in Photoshop combined with an automated action? Wouldn't that work?


----------



## NYBG (Aug 16, 2011)

Hi Robert,

That's what I thought, too. But when I tried it, it simply cut out the black edges of the original image. But that gives me an idea. Instead of using white paper to mask the specimens, I could use black paper - this might do the trick!

I hope it works. I will find out tomorrow.

In the meantime, thanks James, RObert and Lightroom Forums for once again coming to my aid.


----------



## erro (Aug 17, 2011)

Black paper might work better. I guess the Photoshop "crop and straighten" works on some kind of contrast detection, so white paper on white paper is probably hard to automate. But I don't know if it requires white between the cropped photos (since that's what you'd normally get from a scanner), or if back works equally good. Give it a try and let us know!

Also, instead of masking one specimen at a time, I guess you could place many specimens a little bit apart on a black/dark background. This way Photoshop might be able to crop many images at once if you understand....


----------



## NYBG (Aug 17, 2011)

*Black paper - Crop Straighten*

Thank you all. 

I tried masking the negative space with black velvet as below



and then used the Crop Straighten function in Photoshop and got the following result



While not beautiful, it is sufficient for the task. It's science, after all, not art.

Thanks again for all the input.

-Mike


----------



## James_N (Aug 17, 2011)

Glad to see it working for you.

Your first illustration showed 8 samples scanned at once.  Why not continue scanning 8 samples at a time, with the black velvet backing to provide the contrast?  The Crop and Straighten tool in Photoshop will be able to detect the edges of each sample and provide 8 separate images from a single scan.  That will be much more efficient than scanning the samples one at a time.


----------



## Mark Sirota (Aug 17, 2011)

You could use a tool like ImageMagick to separate the full view into 8 separate files, no masking required.  But I think it would have to be done with a fixed "grid", rather than content-aware.  Would that work for you?


----------



## NYBG (Aug 22, 2011)

Thanks James. I tried that, but the crop straighten only found the edge of the whole, not 8 individual specimens. I was hoping it would do what you said. So, that's when we decided to cover the other packets with the black velvet and shoot 8 shots, then use the crop straighten to crop out all the black.


----------



## NYBG (Aug 22, 2011)

Thanks Mark, but a fixed grid would not work for me since the packets are not always arranged on a sheet in the same configuration. If this were the case, I could probably just make an action in Photoshop to do the cropping. A colleague of mine just showed me some freeware called Scan Tailor http://scantailor.sourceforge.net/?q=en but I can not download a Russian .exe file at work for some reason


----------



## erro (Aug 23, 2011)

If you can just have one packet per image, then why hassle with arranging and covering? Just place one packet on top of the black cloth and take a photo.


----------



## NYBG (Aug 23, 2011)

That would be easiest, unfortunately all the packets are glued to the sheet of paper. 

It's really a strange world, the world of Herbaria. I did not even know they existed and probably would have gone my entrie life not knowing what one was until I started working here. An Herbarium is like a living library of plant taxonomy. NYBG's Herbarium has over 7 Million plant specimens housed in a five story, climate controlled archive that scientists from around the world visit in order to do their research. 

If you are interested in learning more, you can watch a video that some of our interns produced at http://digitalphotorepro.blogspot.com/2011/08/nybg-herbarium-kohlmeyer-collection.html.


----------

