Calculate specific areas size in image
I'd like to calculate what area size share do the brown spots take within the area marked with pink lines. See the image here:
In case you wonder what that is - it's an E.coli bacteria colony (don't worry, nothing dangerous) :)
Anyway, I'd like to measure the area that brown spots take, I guess Photoshop will do (not very experienced with it though).
My line of thinking for doing this is:
- Crop the image to areas that are outlined with pink color (would get two images in this case). This is fairly easy and I would know how to do it (selection + crop image to selection).
- Make the image black&white, so the background is white and the spots are black (it should be easier then to calculate the size of the spots).
- Calculate/measure the size of the black spots. If I get this number, I can easily divide it by the size of the image and get the percentage of the area that these spots cover :)
What would be the steps to do that in Photoshop (if it's possible at all)? Or would you recommend some other program?
A camera produces a image that loses any scale information. That is because the projection is flat. Objects at different distances appear sized differently. Likewise certain objects can appear the same.
Image 1: The projection loses sense of scale
This said its possible to know the size, if you have a pair of images (and multiple points in different depths to measure) and a reference measurement in the image.
It is also possible that you just want to compare sizes. In this case the petri dish size is known. Then it can be done if the camera is perpendicular to sample, or sample is perspective corrected right (but this incurs a hard to estimate error).
Image 2: Head on view of a petri dish, image source.
Computing area by relation on perpendicular surface.
If you can photograph like head on like image 2. Then you can just measure the pixel area of the entire circle, and compare that to your marked area. Since the dimensions of the petri dish are known you get a simple relation.
Arp * (Apm /App ) = Arm
Where Arp is the real area of the petri dish (πr 2) in whatever units you want,
Apm is the pixel area of your region in pixels (pm = pixel measurement),
App is the pixel area of your petri dish floor (pm = pixel petri dish) and finally Am the are you wanted to measure.
You can get Photoshop to report number of selected pixels in the extended version of histogram view. This is the area of the selection in pixels.
Image 3: Dummy measurement, gets me an area of ~ 0.15*2800 = 420 mm2 for a petri dish with 60 mm diameter . No measurement confidence calculation done.
Please note due to scale loss effect above you can not use image are for measurement as the distance to target and size/off axis alignment of image is unknown. Measuring both areas ensures a measurement error that is better behaved even if the camera is slightly of axis for said sample.
For a fun deepening understanding in aultomatic 3D correction see The Fundamental Matrix Song
PS: Not entirely Graphics design. After edit definitely no longer Graphics design.