Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Count pixels and calculating overlap between two layers

New Here ,
Sep 18, 2018 Sep 18, 2018

I have two images in their own layers. Both images are line drawings (one is in red and other is in blue), and the background is transparent. First I need to know how many pixels (only color pixels) are in each line drawing. Then I need to control for how much the images overlap so I need a way to calculate the overlap between the two layers. Again I only want color pixels. I've tried to use the histogram settings and I'm a little confused about how photoshop counts pixels -- I get a much lower number if I select the entire canvas (which includes the image on that canvas) as opposed to selecting only a smaller part of the canvas (such as selecting a segment of the image on that canvas). Any help would be appreciated!

1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Sep 18, 2018 Sep 18, 2018
LATEST

Fig2.png

In the test shown above, the Selected the red rectangle measured It 9372 pixels in the Expanded View Histogram which was set to Selected Layer and the ! In the graphic clicked.

Duped the layer and filled the area with blue. Following the same procedure, it also measured 9372 pixels, as expected.

Turned off the blue layer. With Red layer showing, I chose Edit > Transform. It showed the center-point of the color patch. Pulled out a vertical guide to that center point, then canceled the Transform.

Returned to the top layer and moved it right to the center point so that half the patches overlapped.

Changed the Blending mode to Difference.

Used Select > Color Range to Select the overlapping segment (purple) and paced it on a separate layer.

It appears blue because I used. only one layer in making the new layer.

Following the procedure used for the Red and the Blue panel, the Histogram showed 4620 pixels.

The 4620 is not exactly half of 9372  (4686) because I was slightly off the center point in positioning the blue patch. However it would seem that, although this test was not as precise it could have been, the method is valid and I hope adaptable to your purposes*.

*The above is a test of method. In your case, using line illustrations, you would use the Magic Wand tool with Contiguous unchecked in the Options bar to make your Selections.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines