How to do a simple threshold brightness count? ofxOpenCV.


I’m not sure of the correct terminology but I’m basically trying to do something really simple, but being a beginner I’m not sure how to approach it.

I would like to take a count of white pixels from a threshold(ed)? version of a pre-recorded video, live as it plays back.
I will be sending this value to an arduino which will then send the values to a dimmer and affect the lighting conditions of the gallery depending on the video brightness.

I did this before in Max/Jitter using an object called cv.jit.mass which gives a value of the overall number brightest pixels in the frame. How would I go about getting this count in ofxOpenCV. I was thinking of using the threshhold function to adjust the source image that I will read from - but am not sure on how to setup a changing count of bright pixels.

Hope someone can help me.


Sorry I’ve found the solution and it was simple and much more simple than I thought.

I just used the threshold and countNonZeroInRegion() for ofCvGreyscaleImage.

I got most of my info a motion detection thread posted by Progen.

Thanks. sorry for the fuss.

1 Like