First time here? Check out the FAQ!
answered 2017-03-21 03:10:35 -0600
You can use count non-zero function http://docs.opencv.org/2.4/modules/core/doc/operations_on_arrays.html#countnonzero
For white pixels, do the same with inverted version of the image