Area and pixel count in Photoshop vs ImageJ

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Area and pixel count in Photoshop vs ImageJ

Andrew Sanchez
Here are results between Photoshop and ImageJ:

In Photoshop, the measurement log shows that the Area of a 100x100 circle
is 5720.  In my histogram, it reads "Pixels: 5640 pixels."  The measurement
scale is set to 1 pixel = 1 pixel.

My project involves counting the number of green pixels in an image and
dividing that number by the total number of pixels in the ROI, in order to
get the percentage of vegetation.  The number shown in the histogram of
Photoshop next to Pixels is the value I've been using as the total number
of pixels.  Since starting to look into ImageJ, I'm worried that this
method is not accurate.

In ImageJ, I removed the scale and get the correct area of 7860.

I am hoping to switch over from using Photoshop to ImageJ, but I need to
first understand why the numbers I get in Photoshop are so different.

--
Thank you,
Andrew Sanchez
Lab Assistant
Center for Ecosystem Science
Northern Arizona University

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Area and pixel count in Photoshop vs ImageJ

Gabriel Landini
On Monday 08 Jun 2015 16:04:44 you wrote:

> Here are results between Photoshop and ImageJ:
>
> In Photoshop, the measurement log shows that the Area of a 100x100 circle
> is 5720.  In my histogram, it reads "Pixels: 5640 pixels."  The measurement
> scale is set to 1 pixel = 1 pixel.
>
> My project involves counting the number of green pixels in an image and
> dividing that number by the total number of pixels in the ROI, in order to
> get the percentage of vegetation.  The number shown in the histogram of
> Photoshop next to Pixels is the value I've been using as the total number
> of pixels.  Since starting to look into ImageJ, I'm worried that this
> method is not accurate.
>
> In ImageJ, I removed the scale and get the correct area of 7860.
>
> I am hoping to switch over from using Photoshop to ImageJ, but I need to
> first understand why the numbers I get in Photoshop are so different.

Most likely PS is not strictly counting pixels (some area algorithms measure ,
for example, the area inside the boundary pixels), or your image was
calibrated or PS interpolates the boundary.

IJ is correct, I also get 7860 "in number of pixels", but the area inside the
circle I get 7719 "pixels squared "according to the Freeman chain encoding
algorithm implemented in Particles8.
There are more ways of counting lengths and areas to compensate for the
discretisation of the lattice and also various ways of deciding what is the
boundary of an object.
They are not wrong, it just depends what definitions you use.

Cheers
Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Area and pixel count in Photoshop vs ImageJ

Michael Schmid
In reply to this post by Andrew Sanchez
Hi Andrew,

hmm, I don't know where the numbers 5720 or 5640 come from.  With Photoshop CS5, if I create a circular selection with a diameter of 100 pixels (as indicated by the 'Info' panel), the 'Histogram' panel says 7860 pixels.

In ImageJ, a circular selection with a diameter of 100 pixels has 7860 pixels, exactly the same.  In general, one should not expect perfect agreement; as Gabriel already wrote, there may be slightly different conventions on how a circle is delimited.

As Wayne wrote already a few days ago [1], this number is also very close to what you get from an analytic calculation, (r^2*Pi = 7853.98 with r=50). The difference is due to the fact that ImageJ can treat pixels only as inside or outside, not partially inside or partially outside, which would be required for an exact calculation.


Michael

[1] https://list.nih.gov/cgi-bin/wa.exe?A2=ind1506&L=IMAGEJ&F=&S=&P=37730
________________________________________________________________
On Jun 9, 2015, at 01:04, Andrew Sanchez wrote:

> Here are results between Photoshop and ImageJ:
>
> In Photoshop, the measurement log shows that the Area of a 100x100 circle
> is 5720.  In my histogram, it reads "Pixels: 5640 pixels."  The measurement
> scale is set to 1 pixel = 1 pixel.
>
> My project involves counting the number of green pixels in an image and
> dividing that number by the total number of pixels in the ROI, in order to
> get the percentage of vegetation.  The number shown in the histogram of
> Photoshop next to Pixels is the value I've been using as the total number
> of pixels.  Since starting to look into ImageJ, I'm worried that this
> method is not accurate.
>
> In ImageJ, I removed the scale and get the correct area of 7860.
>
> I am hoping to switch over from using Photoshop to ImageJ, but I need to
> first understand why the numbers I get in Photoshop are so different.
>
> --
> Thank you,
> Andrew Sanchez
> Lab Assistant
> Center for Ecosystem Science
> Northern Arizona University

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Area and pixel count in Photoshop vs ImageJ

Cammer, Michael
In reply to this post by Gabriel Landini
We just has a problem yesterday where were getting odd area measurements until we realized that some pixels were set the NaN so they weren't being counted.

Check this?

=========================================================================
 Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical Center
                      Cell:  914-309-3270     ** MY OFFICE HAS MOVED TO SKIRBALL 2nd FLOOR, Back right **
          http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Gabriel Landini
Sent: Tuesday, June 09, 2015 4:05 AM
To: [hidden email]
Subject: Re: Area and pixel count in Photoshop vs ImageJ

On Monday 08 Jun 2015 16:04:44 you wrote:

> Here are results between Photoshop and ImageJ:
>
> In Photoshop, the measurement log shows that the Area of a 100x100
> circle is 5720.  In my histogram, it reads "Pixels: 5640 pixels."  The
> measurement scale is set to 1 pixel = 1 pixel.
>
> My project involves counting the number of green pixels in an image
> and dividing that number by the total number of pixels in the ROI, in
> order to get the percentage of vegetation.  The number shown in the
> histogram of Photoshop next to Pixels is the value I've been using as
> the total number of pixels.  Since starting to look into ImageJ, I'm
> worried that this method is not accurate.
>
> In ImageJ, I removed the scale and get the correct area of 7860.
>
> I am hoping to switch over from using Photoshop to ImageJ, but I need
> to first understand why the numbers I get in Photoshop are so different.

Most likely PS is not strictly counting pixels (some area algorithms measure , for example, the area inside the boundary pixels), or your image was calibrated or PS interpolates the boundary.

IJ is correct, I also get 7860 "in number of pixels", but the area inside the circle I get 7719 "pixels squared "according to the Freeman chain encoding algorithm implemented in Particles8.
There are more ways of counting lengths and areas to compensate for the discretisation of the lattice and also various ways of deciding what is the boundary of an object.
They are not wrong, it just depends what definitions you use.

Cheers
Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Area and pixel count in Photoshop vs ImageJ

Andrew Sanchez
In reply to this post by Andrew Sanchez
It turns out I needed to set the "Feather" setting in Photoshop to 0 px.  I am now getting an area measurement that is consistent with ImageJ.