Half a croissant, on a plate, with a sign in front of it saying '50c'
h a l f b a k e r y
Alas, poor spelling!

idea: add, search, annotate, link, view, overview, recent, by name, random

meta: news, help, about, links, report a problem

account: browse anonymously, or get an account and write.

user:
pass:
register,


                                               

Please log in.
Before you can vote, you need to register. Please log in or create an account.

Pixel Counter

Counter of pixels.
  (+5, -2)
(+5, -2)
  [vote for,
against]

A freely downloadable program that analyses a digital image and reports the number of pixels of a certain colour, for example how many black pixels in a simple monochrome Rorschach image.
Texticle, Sep 12 2007

WIKI Image processing http://en.wikipedia...ogram-Based_Methods
Histogram-Based Methods [Dub, Sep 12 2007]

ImageMagick image processing software http://www.imagemag...nd-line-options.php
The -identify -verbose options do, among other things, print a histogram. A little bit of programming should take it from there. And, yes, it's free. [jutta, Sep 13 2007]

[link]






       What is the benefit of this?
jtp, Sep 12 2007
  

       I'd be surprised if Photoshop doesn't already have a feature that determines area of a selected picture region. You might need to first perform a filter on the picture to isolate pixels of a particular colour.
xaviergisz, Sep 12 2007
  

       Very baked - Most serious image processing packages include a histogramming feature - Can be very handy for all sorts of things - Perhaps [Texticle]'s thinking of it as a form of compression? - Save the histogram data, as it contains a highly compressed version of the image data...
Dub, Sep 12 2007
  

       Even if Photoshop does have a feature like this, Photoshop isn't really freely downloadable.
BJS, Sep 12 2007
  

       Unless you're after a histogram, not seeing the point of this either.
DrCurry, Sep 12 2007
  

       I bet The Gimp has this same feature. But I can't be bothered to look.   

       Also, what is "black"? Is it only pixels with #000000? What about #010101?
Galbinus_Caeli, Sep 12 2007
  

       I could see this as being useful if you counted pixels of a particular range. Like if you want to count everything from #000000 to #330000 you could essentially capture everything that was black or close to being black. But as the author of this invention stated, this would be for MONOCHROME pictures so black pixels are the only thing you are going to have on the screen anyhow.
Jscotty, Sep 12 2007
  

       But you are making a judgment call there. #330000 looks like really dark red to me. But if this is monocrome it could work.   

       Of course I still don't really see the point.
Galbinus_Caeli, Sep 12 2007
  

       Texticle, why do you want to know the number of pixels of a specific color in an image?
BJS, Sep 12 2007
  

       One of the many applications would be area computation. Take a monochrome image of an island (sea is white and land is black) where the scale is known, get the Pixel Counter to tell you how many black pixels, equate that to area and viola!   

       Simple. Just count black pixels. In monochrome white is RGB(255,255,255) and black is RGB(0,0,0). At least they were the last time I checked.   

       Photoshop, histograms etc. You guys crack me up.
Texticle, Sep 12 2007
  

       I would try doing this with ImageMagick, your basic command line do-everything free software thing in that space.
jutta, Sep 13 2007
  

       I still don't get it. I guess I've never needed that information, and probably never will.
BJS, Sep 13 2007
  

       Let's see:   

       counter=0
image = open(imagefile)
for pixel in image:
->if pixel=black:
--->counter=counter+1
print counter
  

       That's pseudocode, but it's darn near valid Python. The actual program wouldn't be much different from that in size or appearance.   

       <edit... much later>
import Image
pic = Image.open( "filename.jpg" )
imgdata = pic.load()
xsize, ysize = pic.size
searchcolor = (0,0,0)
counter = 0
for x in xrange(xsize):
...for y in xrange(ysize):
......if imgdata[x,y] == searchcolor:
.........counter+=1
  

       print counter
  

       I had to write it last night for comparing hot pixels in a couple of digital cameras. That now *is* valid Python. (Jul 19 2008)
</e.ml>
lurch, Sep 13 2007
  

       ImageJ. provided free by the NIH. this program can do this and much more http://rsb.info.nih.gov/ij/
joshkolb, Oct 03 2007
  

       one sample of use   

       i need to find out how many % of a wall is shaded at different times of the day. i capture images of the wall and make the image black and white. process it through pixel counter which will quickly tell me the % of wall that is shaded.   

       i will download and see if ImageJ does this for now.
vikin, Jan 25 2008
  

       Why would anyone need to know that?
BJS, Jan 25 2008
  

       GIMP has it, is freely downloadable.
erlehmann, Jan 25 2008
  

       Hi, guys I need a pixel counter right now!!! :-) I searched it at PSP, Photoshop, LView, GIMP... None has it. I need a pixel counter because I love tapestry. So I drawed a rug to embroid and give for my 5 y.o. grandson. I did it on Windows Paint, and you can see it at my Flickr (Please, see the link to image at my profile.).   

       So, The rug size is 159 x 299 pixels, and it will be 0,80 x 1,50 m when embroided. Each pixel = each stitch. There are 24 colors. As I know, 1m² = 40000 stitches (or pixels) = 1,5 kg of wool. So, if 1,2 m² = 47541 stitches (or pixels) = 1,8 kg of wool, I ask you: - How many black (#000000) wool do I need to buy? - How many dark grey (#808080) wool do I need to buy? - How many light grey (#C0C0C0) wool do I need to buy? (Other colors I don't need to buy). Thank you a lot.
SylMontRok, Mar 31 2008
  

       If I'm using Photoshop's histogram tool correctly, there are 26015 mid grey pixels in your drawing, 4035 light grey ones, and 2634 black ones.   

       (Step 1: Select > Color range for the range you want to count. Step 2: in the "Window" menu, select the "Histogram" tool. Step 3: Find the "Histogram" tab; among other things, it shows the number of currently selected pixels.)
jutta, Mar 31 2008
  

       Great, Jutta!!! :-) I hope you did it correctly. You also taught me to fish! So, answering my questions, I will need to buy 100gr of black wool, 1 kg of dark grey and 155gr of light grey this afternoon. :-)
SylMontRok, Mar 31 2008
  

       Area calculation based on pixels: I ould like to mention that you can use lurch his code to calculate areas of stuff in a bitmap image by counting the pixels.   

       Many thanks to lurch for the python code.
mikrofoon, Apr 09 2010
  
      
[annotate]
  


 

back: main index

business  computer  culture  fashion  food  halfbakery  home  other  product  public  science  sport  vehicle