16 Replies Latest reply on Dec 17, 2014 5:11 AM by norman.sanders

# How to determine the number of pixels of a desired object within a digital photograph?

Hi everyone. I want to determine the number of pixels in an object that is part of a digital photo. I use cameras to film chunks of ice breaking away from ice cliffs or tidewater glaciers. I want to know the size of the ice chunk that my digital photographs capture. I know the width and height of the ice cliff in metres already, so I was thinking that I could convert the equivalent of 1 pixel : ? metres - this is really what I want to do. That way every time I see a chunk of ice breaking off, I can pull up the photo, outline the chunk, calculate how many pixels fill the area of ice removed by the chunk breaking off and convert to metres area 2 - thus giving me my size order. If anyone has ideas on how to do this I would really appreciate it, thanks so much community. I was thinking that Photoshop or Fireworks could help me with this, Ricky

• ###### 1. Re: How to determine the number of pixels of a desired object within a digital photograph?

Make the selection

Choose the Histogram panel and click the symbol in the upper right.

Choose Expanded View

See this:

• ###### 2. Re: How to determine the number of pixels of a desired object within a digital photograph?

You should have Photoshop Extended, CC or CC 2014 for measurement analysis.

Here's the help doc: Photoshop Help | Measurement (Photoshop Extended)

Gene

• ###### 3. Re: How to determine the number of pixels of a desired object within a digital photograph?

Works nicely, norm.  The other way logs measurements and will assign a scale to the pixels, but it is a steeper learning curve.

Gene

• ###### 4. Re: How to determine the number of pixels of a desired object within a digital photograph?

Hi Gene. Thanks for the thumbs-up!

• ###### 5. Re: How to determine the number of pixels of a desired object within a digital photograph?

Too bad there is no possibility of using the old Archimedes bathtub gimmick for your project. You have to figure this out the hard way. I suspect that, for accuracy, the ice cliff, with its known height, must be included in each picture that also shows the breakaway ice or the cavity it leaves. In that way a pixel count of each -- cliff and piece -- would provide the relative value of each pixel. I guess if you measure the breakaway section, its distance from the ice cliff would affect your calculations and I don’t know how important that is. (I’ll leave it to you to calculate the volume of the piece. I haven’t a clue)

Perhaps, if you could not include the ice cliff height in each picture, it would be prudent to consider a using a fixed focal length lens for all shots and somehow either maintain a constant distance from the ice cliff or use the various distances in your calculations.

It sounds like truly interesting and valuable project. I hope the histogram illustration I posted is a help and I wish you the best of luck

• ###### 6. Re: How to determine the number of pixels of a desired object within a digital photograph?

Hi normfb,

Thanks for writing back so quickly. I appreciate that:

I do have one question:

When I use the histogram approach, Photoshop gives you the mean, medium, and pixel count of the cropped area selection within the digital photograph. In my ice cliff photo the pixels = 6492, the mean is 104.61, and the medium is 99. Which of those values should I use to convert to metres equivalent?

• ###### 7. Re: How to determine the number of pixels of a desired object within a digital photograph?

Thanks gener7 and normfb.

The Photoshop help measurement page is brilliant and I think I can use the info on that page to work out my iceberg sizes. Check out the attached photo - you are looking at an ice cliff - essentially the front of a tidewater glacier that flows in the ocean. I'm a research student and I look at the process of iceberg calving - this is the term we use to define the sudden breaking away or detachment of ice chunks from glaciers that end in the sea.

I used the lasso tool to crop the area of ice lost as a single chunk of ice detached from the ice cliff. At the same time I had the histogram window open. The histogram showed me how many pixels were contained in the cropped area. What I need to do now is work out what 1 pixel is equivalent to in metres. Soon I will have a digital elevation model for the ice cliff that will offer centimetre to metre scale resolution of the surface topography - so that should really help. The photographs I have are taken every 30 seconds - which is brilliant for documenting how the geometry of the ice cliff adjusts in response to detaching ice pieces and also because the ice is moving. I am a research student in Canada, and at the time I took the photos we measured that the ice cliff was advancing at a rate of approximately 12 metres per day! That's pretty fast. The flow of the ice is a first order control on the rate of iceberg production - you are essentially pushing ice into the ocean where it breaks off. I'm having to learn everything Photoshop from scratch...so please bare with me because maybe some of the photoshop questions I ask are simple to most!

I noticed the "integrated density" function on the help sheet you suggested. This function also provides the square number of pixels contained in the cropped area I select...I guess this is similar to the histogram right?

Either way - i just need the scale conversion to go from 1 pixel : metres or cm equivalent. At that point I think I will have to manually select every single iceberg event from my time-lapse photos and do this the manual way!  I have about 800 events to manually digitise and calculate the area for...

Thanks everyone, Ricky

• ###### 8. Re: How to determine the number of pixels of a desired object within a digital photograph?

I am not sure how the number of pixels relate to the project other than as a percent of the total pixels in an image or larger segment of the image. Mean and medium are not involved. Beyond that I am unaware of how to use the data. Perhaps one of your colleagues could be of help.

• ###### 9. Re: How to determine the number of pixels of a desired object within a digital photograph?

Here how you would set up a custom scale:  Image > Analysis > Set Measurement scale.

Here I define a Preset and give it a descriptive name.

It will then be stored under Image > Analysis > Set Measurement Scale > Iceberg 1 px to 1m

Then measure away. Click on record for each ice chunk you select with the polygonal lasso tool.

• ###### 10. Re: How to determine the number of pixels of a desired object within a digital photograph?

This will take a bit to get used to, but  there are some great learning resources.

The Histogram is a simple way to measure pixel areas, but afaik, it's not set up for logging and custom scales.

Gene

• ###### 11. Re: How to determine the number of pixels of a desired object within a digital photograph?

Hi Gene,

Thanks so much. I just need to know how many pixels = x number of metres then I can set the scale and measure away as you said. I think this will work and I just tried it! I only know that the height of the ice cliff is 50 metres from the waterline to the top of the front row of ice...but soon I'll have a high resolution surface model that will provide a better handle on how far one metre is on the photo.

Just out of interest - I'm using Photoshop CS5 extended. Is there any reason to move to CS6, or CC. My friend uses CC. I noticed some cosmetic changes but is it more user friendly? Worth upgrading?

• ###### 12. Re: How to determine the number of pixels of a desired object within a digital photograph?

Gene, I am out of depths here but wouldn't the square root of the number if pixels, converted to metres,provide the area of the calved element?

• ###### 13. Re: How to determine the number of pixels of a desired object within a digital photograph?

So am I, norm   I never get called on to do Image Analysis.

I'm sure the Histogram method will work. Pencil, paper, and a calculator should cover the conversions and logging.

The only thing Image analysis brings to the table is conversion and logging multiple measurements. The log can also be exported if need be.

Gene

• ###### 14. Re: How to determine the number of pixels of a desired object within a digital photograph?

You'll only know if you need the features.  CS5 may not perform well on future OS upgrades or retina screens.

Compare Photoshop versions, version history | Adobe Photoshop CC

Gene

• ###### 15. Re: How to determine the number of pixels of a desired object within a digital photograph?

Ricky, there is just one last thing I would like to add that I think you may find helpful in your calculations.

You wrote: "I know the width and height of the ice cliff in metres already, so I was thinking that I could convert the equivalent of 1 pixel : ? metres - this is really what I want to do."

If you could make a one-pixel column from the base of the ice cliff to the top and have the histogram tell you how many pixels it contained, you could then know the value to convert pixels to meters.

Photoshop can do that.

Nested with the Rectangular Marquee tool is the Single Row Marquee Tool and the Single Column Marquee tool....your ruler!

By using the single pixel marquee and the Histogram pixel quantity readout, the problem of pixel-to-metre is solved.

I have tested this and it works. Whew!

HOW TO:

1. The image with base to cliff known height must appear in the picture with the ice fragment.

2. Make a dupe image and crop it to the ice cliff height and base line.

3. Click with either the Column Marquee tool...and get the pixel readout in the Histogram panel.

4. You now can compute your pixel-to-meter conversion.

5. Made another dupe of the same image and crop to the height of your ice fragment

6. Click with the Column Marquee tool and get the readout in the Histogram panel.

7. Use the conversion factor of Step 4 to determine the height of the ice fragment.

Job done. Wow!

• ###### 16. Re: How to determine the number of pixels of a desired object within a digital photograph?

I checked it again and I believe we touched all he bases.

1. We can convert pixels to metres (previous note I wrote last night)

2. We can count the pixels inside a selection.(my first note)

3. We can find the area of a selection by taking the square root of Item 2 (earlier note referencing square root)

4. And finally, we can measure the length and width of an object. (previous note I wrote last night)

That wraps it up.