quick way to measure how much white there is in a black and white matrix?
Is there a fast way to do this that isn't processor intensive? I just want a proportion. I'm using blob tracking, I want to know how much space is being occupied. I figure I can use jit.iter but that seems intensive for the CPU.
jit.3m ??
Here's a quote from the description of HoldStill (Jitter Recipe #32 - book 3)
The jit.3m gives the mean value of all of the cells in a matrix. If you remember your arithmetic, you will know that the mean is derived by adding all elements together and then dividing by the number of elements. We take the inverse approach to calculate the total number of white pixels in our image.
This is done by first multiplying the mean output by 327,200, which is the total number of pixels in a 640×480 matrix. Since the value of white in char data is 255, we must then divide by 255 to get the number of white pixels.
Good luck.
Thanks.