What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Pixel count in histogram


sabos909

Member
Messages
6
Likes
0
Hi all,

I'm working with a marine imaging lab and have been utilizing Photoshop CC to make area measurements of sediment profile images (SPI) of the sub-seafloor.

Our camera set up utilizes a camera inside of a wedged prism that penetrates the seafloor and takes a photograph of the sedimentary matrix in-situ. The image returned is then manually separated into two layers in photoshop and measured, one layer for the portion of the image penetrating the sediment, and another for the portion of the image showing the water above the seafloor. By selecting each layer and commanding the histogram window to display a pixel count from the selected layer only we establish an area of penetration in out image. Up until today the histogram was giving me a very accurate reading. Today we updated our workflow to utilize 16 bit Adobe RGB images converted to .psd directly from camera raw in 300dpi resolution. Our previous workflow involved converting .raw to .jpeg to .psd in 8 bit, 300dpi resolution. The images look great now but the histogram returns a pixel count of about half of the previously measured values. What is going on here? I can still achieve n accurate pixel count by ctrl clicking my penetration layer and selecting a histogram read from entire image, it still drops a handful of pixels around the marquee but it is much closer to reality.

Any help would be much appreciated.

Cheers,

-Steve

no-marquee.jpgMarquee.jpg
 

sabos909

Member
Messages
6
Likes
0
Also, just in case anyone was interested what our rig looks like. We shoot with a Nikon D7100.

camera_schematic.jpg

t2_spi_machine_deck_shot.jpg
 

Tom Mann

Guru
Messages
7,223
Likes
4,343
Sounds like a very interesting problem. The most direct way to get to the bottom of this is if you could make available two set of files that illustrate this discrepancy:

a) A set of files (eg, raw, PSD, any other intermediate files in your workflow) illustrating your previous procedure, along with the pixel count that you obtained; and,

b) Same as above, except for your new workflow.

My guess is that the size of all these files (in both pixel dimensions and MB) will exceed the limits set by the forum's uploading software, so, you probably should make them available using Dropbox (or equivalent), or via an FTP site. If you don't want them to be seen publicly, just send me their location via a forum private message

I'll try to have a look at them late tonight.

Tom M
 

sabos909

Member
Messages
6
Likes
0
Sure Tom,

I've uploaded them to a Google Drive folder, which can be accessed here:

https://drive.google.com/folderview?id=0B_XkORRtWN2OM2JVbnBzNHFvelU&usp=sharing

I only included the single "Pen" layers that I'm trying to measure. Each gives a very different pixel count according to the histogram. Again, the ".psd from .nef" version gets a lot closer to the ".psd from .jpeg" version when a selection is made from the layer and the source is set to entire image.

-Steve
 

Tom Mann

Guru
Messages
7,223
Likes
4,343
I only have a minute or 2, so this has to be a short message, but I get essentially the same number (ie, to within a percent or better) for both images that you sent me:

From the JPG: 225,350 non-transparent pixels

From the NEF: 225,632 non-transparent pixels

All I did was control-click on the "Pen" layer in both. That made a selection out of the non-transparent pixels, and then I read out the number of pixels at the bottom of the histogram window.

I think you are saying that you get the same results as me, but that when your PSD file includes two layers, (not just a single layer like in the ones you sent), then you get different numbers. If this is correct, then the only way I can check this is (and hopefully, tell you what's going on) is if you send me a file with two layers.

Gotta run.

Tom M
 

thebestcpu

Guru
Messages
2,989
Likes
2,750
Hi Steve
I'll jump in here along with Tom about the pixel counts.

There can be several problems for this yet yours is that you are in 16 bit mode with two layers. It is really strange yet I have seen this. Let me quote the help file from Adobe about the Pixel Count:

pixels:histogram display ofPixels

Represents the total number of pixels used to calculate the histogram.

If you read it directly it is not telling you that it will count all of the pixels. When I have used 16 bit mode under certain circumstances the count is divided in two. You can easily check this by just temporarily changing to 8 bit mode and see the count double back up.

Here are the other two issues that come along (these are not your primary issue)

- If you are doing a count of pixels of a Layer and the transparent pixels are not absolutely transparent then they will be counted as a full pixel. I don't know how your are erasing you image pixels yet brushes have partial transparency to worry about. Erasing in 16 bit mode does not as easily get down to absolute transparency if there is only partial erasure or a feathered brush

- Pixel counts don't always update when you take various actions. Sometimes the cache level indicator changes indicating you need to refresh yet there are other times when you can be erasing pixels and the count won't change at all.

So bottom line there are several ways you can run into issues yet yours is just that you are using 16 bit mode and getting a half count with the Layers used the way they are (my best guess from experience)

Hope this gives you something to look at.
 

Tom Mann

Guru
Messages
7,223
Likes
4,343
John, thank you for jumping in!

Steve, do John's observations explain what you are seeing?

Tom
 

sabos909

Member
Messages
6
Likes
0
Hey John,

Thanks for the input. I'm well aware that the cache needs to be refreshed to achieve a proper histogram reading.

When I have the full image I use the lasso tool to select the boundary of water and sediment, then I use an action sequence that I've created which copies the selection to a new layer and renames it "Pen". There shouldn't be any issue with transparent pixels.

You were right on the money regarding 16-bit/channel halving the histogram pixel count; I switched back to 8-bit/channel mode and it gave me an accurate reading. It's just strange to me that the histogram is the only readout that is effected. I've been using the ruler tool heavily as well, which doesn't change at all in different modes. Also, I work with a pure black layer created by copying a selection created through the color range tool, this selection is consistent between 8 and 16 bit modes. Incidentally, the "Pen" layer gives different readings even when filled with pure black. I'm just stumped as why this is the case.

Thanks for the help everyone. I've been able to get around this problem fairly easily and was mostly just curious as to what exactly was going on here.

If anyone want's to see the color range selected layer I've added it to the Google Drive docs.

-Steve
 

sabos909

Member
Messages
6
Likes
0
Actually, scratch that comment about the pixel count being equal for my aRPD layer. It turns out that they are different between 8 and 16 bit modes.

I'm reading:
3016610px
3414497px

I wasn't too worried but this is a problem. These two number calculate to area measurements of:
2.74cm
3.11cm

This is a pretty significant difference in describing the phenomena that we are trying to measure and could mean action taken on the ground based on faulty survey data. I have a feeling that the problem gets worse as my area gets larger.

I may have to abandon the 16 bit workflow if I can't resolve this issue, which would be a real shame...
 
Last edited:

thebestcpu

Guru
Messages
2,989
Likes
2,750
Hi sabos
Not sure if you read my prior post above with the potential issues with pixel count yet thought about your problem and I can give you an alternative that can bypass all of those issues. The approach below will allow you to stay in 16 bit mode and give you 0.4% accuracy on your count (if you need higher resolution let me know as with a few more steps you can get .003% accuracy)

- duplicate the Layer where you have already erased the upper sediment
- Layer > Layer Mask > From Transparency (this creates a Layer Mask pulling the transparency into the Layer Maks)
- Option click on Layer mask Thumbnail in layers Panel to open the mask image
- Image > Adjustments > Threshold and accept the mid point setting (this will force any partial transparency into full transparency or fully opaque to eliminate that source of partial transparency error)
- With Mask still visible Filter > Blur > Average (this averages out all pixels to one value)
- Now use the info panel with RGB setting or read in 8 bit mode and read any pixel in the mask image displaying and divide by 255. This will give you the percentage of area of the whole image that was not transparent. Just multiply by the actual area the image is supposed to represent and you have your actual area answer.

I am pretty confident this will work to 0.4% accuracy. It is limited to this accuracy because even in 16 bit mode Layer Masks are still in 8 bit mode (0.4% = 1/256)

If you need higher accuracy this can be done in a few more steps yet thought this might be good enough for you.

Hope this gives you another direction to consider.

ADDED EDIT - You can also automate most of this with a PS Action
 

Top