(Info largely based off of Google searches)
Calling imaqGetPixel repeatedly will probably give you very bad performance. If you're using C++, try imaqGetImageInfo instead to get direct access to the pixel data. See
here for an example of how to use it.
If you're using LabVIEW, there's a imaqImageToArray function, but this creates a copy of the image data, and so will be slower than the imaqGetImageInfo method.
You could also call imaqQuantify which returns summary statistics about the image, include the mean pixel value. You can multiply the mean by the pixel size of the image (width*height) to get the number of 1 pixels.
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor