Using Adobe Photoshop for Research and Profit

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?