1 | initial version |
please don't write per-pixel loops, when using opencv.
the problem in your case seems to be, that your input frame is grayscale(CV_8UC1), but your code assumes CV_8UC3
what you should use instead is threshold , which is type-safe, faster, and less error-prone, like:
threshold(frame,frame,127,0,THRESH_TOZERO);