PDA

View Full Version : Help with auto-masking squares around circles


klo
09-26-2005, 12:05 AM
Link to the database:
http://kevinludlow.com/coins.html

Hi -- I've never posted here but was hoping that someone might be able to help me with a little photoshop problem. I would say that in general I am a lower level Photoshop user, but a very high level computer user.

The problem:
I have created a database of my foreign coin collection. There are about 500 coins resulting in 1000 total images. All of these images were acquired by laying the coins on my scanner (about 20 at a time) and scanning at 1600 DPI. I then went through each digital sheet of 20 coins and would make a 2500 x 2500 pixel marquee around each coin, crop it, and save it uniquely by its database ID number.

So, right now I have 1000 images all 2500 x 2500 pixels. This results in the coins sizes being relative to one another. (ie: you can tell a 2" coin is larger than a 1" coin by comparing the JPEGS). It also obviously results in images having tons of whitespace surrounding the coins. I would like to maximize the visable area of the coins.

Is there a way that I can automate the process to have photoshop 'guess' (to a reasonable level), where the edges of the coin are and form a FIXED RATIO SQUARE marquee around the coin?

I am familiar with writing photoshop scripts (actions I guess they are called), so if someone could possibly help me with getting the marquee to automate itself, I could write the action to do all 1000 of the images.

Thanks much in advance, and if someone might have an idea, please let me know if I can somehow provide more information towards the problem.

-Kevin

Scott W.
09-26-2005, 12:13 AM
Hi Kevin,

Provided the background has a good contrast from the coins, you could write an action that does the following:

Unlock background layer
Select color range
Delete
Image > Trim > Transparent Pixels
Save as

This should result in images that are only as large as the coin. You could also automate a level adjustment in there possibly to improve contrast with the background before doing the color range selection.

Hope that helps.

klo
09-26-2005, 12:22 AM
Provided the background has a good contrast from the coins, you could write an action that does the following:

Unlock background layer
Select color range
Delete
Image > Trim > Transparent Pixels
Save as


Wow -- that was really fast and sounds like something that could entirely work. Yes, each of the coins has quite a bit of contrast to them. Even the lightest in color coins that I have (typically the aluminum metal ones) contrast against the creamy white background well.

Thanks very much for what seems to be a very simple and elegant solution. I will give it a go and let you know if it works.

-Kevin

d-signer
09-26-2005, 01:22 AM
Damn Photoshop! There is special thing to do it, quote from online PS help:

To use the Crop And Straighten Photos command

The Crop and Straighten Photos command (File > Automate > ...) helps you make separate image files from multiple images in a single scan. For best results, you should keep 1/8 inch between the images in your scan, and the background (typically the scanner bed) should be a uniform color with little noise. The Crop and Straighten Photos command works best on images with clearly delineated outlines. End quote.

But if crop works fine then straighten here completely unnecessary - it rotates coin randomly and even clipped.

klo
09-26-2005, 01:55 AM
Damn Photoshop! There is special thing to do it, quote from online PS help:

To use the Crop And Straighten Photos command

The Crop and Straighten Photos command (File > Automate > ...) helps you make separate image files from multiple images in a single scan.


Umm, so I am entirely retarded and that actually works REALLY well for this particular project. Perhaps I should have read more photoshop help stuff before jumping into this project but I guess you live you learn. Thanks so much for that VERY SIMPLE tool which does EXACTLY what I want it to do.

I'll post my coin DB just as soon as I have it all online. Should be in a few more days.

(not that it will necessarily be that interesting to photoshop gurus)

-Kevin

d-signer
09-26-2005, 06:02 AM
Btw, you could Trim image not only by transparent pixels but the opaque too: Top Left or Bottom Right pixel color. And with zero tolerance. :)

klo
09-28-2005, 11:50 PM
Thanks so much for the help. I have had the software written and it was nice to finally get the coin images online. If anyone is interested in coins, you are welcome to check out my database.

http://www.kevinludlow.com/coins.html

Thanks again,
Kevin

d-signer
09-29-2005, 04:51 AM
Wow! Great database! I am just wondering how did you collect *info* about each coin. It seems very hard work (at least very long).

klo
09-30-2005, 12:01 AM
Wow! Great database! I am just wondering how did you collect *info* about each coin. It seems very hard work (at least very long).


Well, except for a few of the coins that are really old, the information came from a coin book that is published. I have a link to it from the main coin database page: http://www.kevinludlow.com/coins.html

It was tedious, but a labor of love I suppose? Plus -- I think I wrote the software pretty efficiently, so there wasn't much overlapping of work to do =]

klo
10-06-2005, 12:09 AM
Wow! Great database! I am just wondering how did you collect *info* about each coin. It seems very hard work (at least very long).

Actually, since I first posted this message, I've been getting tons of help identifying some of the coins on the coin forums I've posted the link on. It's been amazing how generous people have been with sending me emails and such helping to identify coins I previously could not figure out.

-Kevin

d-signer
10-06-2005, 03:59 AM
Great. But what about special sofware for coin's scan-edit-publish? Is there anything?