Using Adobe Photoshop for Research and Profit

May 5th, 2008
Photoshop CS3 Extended is a powerhouse. Beside the usual support for making fake celebrity nudes and airbrushing out your blemishes for Facebook profile pictures, did you know it has support for a wide selection of image measurements?

Simple image processing can be fun and easy with Photoshop. Various books have even been published on the use of Photoshop in forensic science!

I recently watched a Lynda.com tutorial on using Photoshop for Biomedical research and Photoshop for Research Methods and Workflows. The latter included a step-by-step guide for image processing techniques from analyzing protein expression in microarrays to obtaining penetration data in tissue sample. But I think it’s safe to assume that most reader’s aren’t concerned with biomedical research, so I decided to take the measurement idea and run with it.

In this post I’ll outline some applications of Photoshop’s measurement tools which should not be missed! Note that this tutorial assumes you already have basic knowledge of opening images, working with layers, and making selections.

Measuring the Lean of a Leaning Tower of Jenga

Tower of Jenga Pisa

How would one go about comparing the leanosity of this Leaning Tower of Jenga compared to the real Leaning Tower of Pisa?

Just use the Ruler Tool across the edge of the tower and read it off the “A value” in the Options toolbar across the top of the window
Alternatively you can select Record Measurements from the Analysis drop down menu and scroll over Measurements Log to Angle.
Turns out the real Leaning Tower is about 86.03°. Pretty accurate lean!

How to Measure the Circularity of the Moon Circularity of Moon Phases
Adobe writes “Circularity is the calculation 4pi(area/perimeter^2). A value of 1.0 indicates a perfect circle. As the value approaches 0.0, it indicates an increasingly elongated polygon. Values may not be valid for very small selections”.

One can do many interesting things with this measurement. For example, you may be interested in comparing the circularity of your head to that of a friends.

I was more interested in the practical measurement of the circularity of the moon during the lunar cycle as depicted above.

Use the Magic Wand to select the emptiness of space
Invert the selection with Select > Inverse, and subtracted the moons from the selection I wasn’t interested in using the Rectangular Marquee.
Goto Analysis and Record Observations in a manner similar to the previous example.
Record the value of the Circularity heading in the Measurement Log.
All werewolves know that there are approximately 30 days between each full moon. Using this fact, along with Photoshop, and a digital camera one could determine the day of the month based on circularity alone!

Counting Candies in a Candy Bowl

Highlighted Green M&M\’s

Using the Magic Wand Tool, one can select a region of a single green colored M&M from this delicious bowl.
Once you have a green M&M selected, choose the Similar option from the Select drop-down you can expand this selection to the entire image. You may have to play a bit with the tolerance of the initial selection.
Once you have a decent selection, goto Analysis > Record Observations
By observing the Count heading of the Measurement Log you can see exactly how many M&M’s are selected.
I manually counted 74 and using the steps outlined above I got a count of 70. This technique could be used to count freckles, stars, or any distinctly colored/separated objects!

Measuring the Efficacy of Teeth Whitening Products

Crest Teeth Whitening Quantitatively Compared

You must have heard of these teeth whitening products by now. Typical they are hydrogen peroxide gel-based and bleach the yellow out of your gnarly coffee teeth. I searched all over the internet for a review of the damn things but all I could find was dentistry spam! Wouldn’t it be nice if someone actually reviewed them with real quantitative data? If you have Photoshop it’s way easier than you think.

Bring a close-up photo of your smile into Photoshop CS3 Extended
Use the Rectangular Marquee to select a sample of color on your teeth
Goto Analysis and Record Measurements.
On the pop-up observations box just scroll over to “Mean Gray Value” and record that number.
Repeat steps 1-4 throughout your whitening procedure and graph the whitening over time!
Note: The gray value will likely be a number from 0 to 255. Also, the pictures above are from actual dentistry work and not an over the counter bleaching product!

Calculating the Height of Kirsten Dunst

Calculating the Height of Kirsten Dunst

Sometimes you’ll catch Kirsten Dunst on the beach reading Carl Sagan’s “The Varieties of Scientific Experience“. Using the fact that the book is 9.2 inches high according to Amazon we can calculate Kirsten’s height with a fair degree of certainty.
Access the Analysis menu option Set Measurement Scale > Custom so you can set a new measurement scale for the ruler tool.
Once the Measurement Scale dialog box is open, click and drag using the Ruler tool across the edge of the book
Fill in the values for the logical book length as 9.2 inches and press Ok, all further Ruler measurements are scaled by this length.
Use a series of Ruler measurements to total up Kirsten’s height.
I got a height of 67 inches, or 5’7. I guess I overshot her height a little bit according to Chickipedia.

Estimating the Number of Chickens in Africa

Africa\’s Chicken Population Density

Determining the number of chickens in Africa would be impossible without a Chicken population density map. Thankfully, I discovered one on Google. This is a more involved example, but mostly because of the pre-processing needed on the particular map I discovered. Ideally, the measurement one would use for this in Photoshop is “Integrated Density“, which is equivalent to the product of the area and mean gray value of the particular selection. To prepare the sketchy map I got, I needed to do the following super boring things which I will not go into detail about:
Had to save a selection of Africa and its islands with a contracted edge.
Had to set a calibration scale to kilometers using a superimposed world map.
Forced to replace the black lined borders inside Africa with colors similar to neighboring regions.
Needed to accurately convert the image and color coding to grayscale.
After way too much work, you select Africa and click Analysis > Record Measurements. There will be many measurement entries but the one with multiple values in count should be the combined selection of Africa and its islands. I obtained an area of 30.11 million square kilometers which compares well with the actual value of around 30 million km^2.

Unfortunately, you can’t use the Integrated Density in this case, since mean gray value which is a value from 0 to 255. Although, we can scale our mean gray value (36.32) by dividing it by 255 and multiplying by 125. I chose 125 as the maximum number of chickens per square kilometer. This gives a Mean Chicken Population/km^2 of 18.

Using the M.C.P./km^2 multiplied by area of Africa it is certain that there are around 542 million chickens. 18 Chickens per kilometer sort of seems like a lot when you consider the desert, but who knows!

As you can see, Photoshop is such a powerful tool it’s no wonder it cost $1000 to purchase! Can you think of any other interesting image measurements I could make?

Posted by Chris Filed in General
21 Comments »
21 Responses to “Using Adobe Photoshop for Research and Profit”
agm Says:
May 5th, 2008 at 5:21 am
You should dub it something like the areal (aerial?) chicken density

Can you try and calculate Says:
May 5th, 2008 at 6:21 am
How many balls Kirsten Dunst has?

Thank you

ben Says:
May 5th, 2008 at 6:31 am
please don’t say ‘after the jump’. please? 🙂

zachrahan Says:
May 5th, 2008 at 8:04 am
ImageJ from the NIH is a free, open-source, cross-platform Java application for doing these sort of image analyses. The UI may be a bit rough, but between its excellent scriptability, the different plug-ins available, and being free, it shouldn’t go unmentioned.

will Says:
May 5th, 2008 at 8:20 am
67 inches is 5’7

Chris Says:
May 5th, 2008 at 8:42 am
agm:
are you suggesting there are undocumented underground chickens?

ben:
what else am i going to call it, the page break?

zachrahan:
i’ll definitely take a look at ImageJ

will:
thanks, fixed!

whatever dude Says:
May 5th, 2008 at 10:24 am
Measuring the Efficacy of Crest White Strips:

Photoshop will also tell you that there has been more work than the whitening. If you look at the shapeof the “before” and “after” pictures you will see that the “after” teeth are longer, straightened and it appears with added structure. Not a good example at all of whitening, but going to a dentist. Interesting that you did advertising for one brand name as opposed to just specifying “whitening” – advertising like that destroys credibility.

TV Spy Says:
May 5th, 2008 at 11:17 am
That can’t be real, was Kristen Dunst actually reading Carl Sagan ..ahh the miracles of photoshop.

Chris Says:
May 5th, 2008 at 5:25 pm
whatever dude:
Thanks for making me feel like an advertising jerk! But I see where you are coming from and I fixed that passage to be more general.

links for 2008-05-06 « Donghai Ma Says:
May 6th, 2008 at 12:30 am
[…] Jacks of Science − Using Adobe Photoshop for Research and Profit (tags: photoshop statistics science analysis tutorial software interesting analytics howto) […]

Using Photoshop as Measuring Tool « Gems Sty Says:
May 6th, 2008 at 10:39 am
[…] Answer, and quite a few more of such examples, over at Jacks of Science. […]

jsam Says:
May 6th, 2008 at 12:03 pm
Huhh. Look at the leaning bottle of water at the feet of the tower! Not the tower, but the camera is leaning…

Woody Thrower Says:
May 8th, 2008 at 2:28 pm
In the leaning tower of Pisa example, you’re assuming that the horizon is level in the photo, but if you look at the ceiling in the background, you can see that it is not. The “level” angle should be parallel with the ceiling.

Rob Says:
May 10th, 2008 at 4:53 pm
You guys are pretty negative and hardcore. Give the guy a break. All he was trying to do was to show some interesting uses for Photoshop’s analysis function. Independent of mentioning brand names what’s the big problem?

Go spend your free time doing something construstive like scraping Orbit gum off of the sidewalk and we Photoshop users will continue to enjoy fun tips without your harsh comments.

YaY Says:
May 18th, 2008 at 12:26 pm
Internets are serious business Rob.

Photoshop Scoop » Wie groß ist Kirsten Dunst? – Photoshop’s Analyse Werkzeug Says:
May 22nd, 2008 at 6:04 pm
[…] Analyse Werkzeugen kennenlernen will, der sollte auf jeden Fall einen Blick auf die Website “Jacks of Science” werfen. Hier wird unter anderem erklärt, wie man die Anzahl von Hühnchen in Afrika, den […]

Amine Says:
May 29th, 2008 at 6:26 am
Hi

Here’s some of my work flow

Woody Thrower Says:
July 18th, 2008 at 2:32 am
I agree with Rob about the negativity, and I’m one of the guilty parties. In my comment where I mentioned the non-level horizon, I wish I had ALSO mentioned that I enjoyed this post, and found the ideas interesting even if the execution wasn’t perfect.

Some of us are just a little obsessive-compulsive. Let me demonstrate:
If you use the ceiling, doorway, water bottle, and copy machine (or whatever that is) as horizontal/vertical reference objects, the tower is leaning about 2 degrees less than estimated–an angle of 87.35 degrees, or 2.65 degrees from being vertical.

Clarence Says:
January 7th, 2009 at 2:25 am
eKuFEtsteKGmP

suzi Says:
May 14th, 2009 at 8:22 am
great tutorial this may also help.

http://www.mutinydesign.co.uk/web-design-resources/levelling-photographs-using-photoshops-ruler-tool/

vibe web design Says:
August 26th, 2010 at 8:26 am
Internets are serious business Rob.

Leave a Reply
Name

Mail (will not be published)

Website

SEARCH THIS SITE

PAGES
About Us
Archives
Blogroll
Music
CATEGORIES

Select Category
BLOGROLL
A Blog Around the Clock
Astronomy Picture of the Day
Biology in Science Fiction
Improbable Research
MacResearch
Molecule of the Day
Pharyngula
Shtetl-Optimized
Uncertain Principles
CANADIAN SCIENCE BLOGGERS
Backreaction
BioCurious
Drugs and Poisons
Eastern Blot
Genomicron
Michael Nielsen’s Blog
Morning Coffee Physics
Physicality of Words
Sandwalk
Science Creative Quarterly