Here's 6 grey opaque pixels in a 1000x1000 image, all other 999994 pixels are fully transparent:
Counting them visually causes at least for some of us some problems as you might have noticed.
You can select them by clicking the image icon in the layers panel and holding Ctrl at the same time. Then you can expand the selection. In the next image the the selection is expanded by 10 pixels. A new layer is inserted. The selection is filled with red by applying the paint bucket with no antialiasing nor contiguous selected:
Now at least the enlargened pixels are visible. Unfortunately adjacent opaque pixels can be difficult to see because they become nearly one when expanding the selection. One spot is this in pixel view:
It's not square, but it's pixel count can easily be calculated. It's 381.
In principle one could use white instead of red, merge the dots with a solid black layer and apply the averaging blur. The resulted brightness would be proportional to the number of opaque pixels.
Just for fun I adjusted the dot layer to pure white with curves, made 4 copies of the dot layer, moved the copies apart and merged them to a solid a black layer:
If you watch carefully you see that the color mode is changed to RGB 32 bit/Channel. With it filter Blur > Average makes a substantially different than zero result:
All channels have 0,0093. That's probably truncated or rounded in calculations, the exact average can as well be for example 0,0094 or 0,0092 or something else - only Adobe knows how accurate the result is. If we divide 0,0093 at first by 4 and then by 381 and finally multiply by 1000000 we get 6.1 I do not recommend to use this fun calculation for anything important. As said it doesn't know if there's amalgamated dots or dots over the border.