c++ - How to get pixel value of Mat image with webcam capture in OpenCV -
Well, I'm new in OpenCV and image processing and I definitely want help to get every pixel value of Mat I need this image captured by webcam (real time). I have tried some solutions to the problems of some people, but this is not working on my project. This is my code:
mat black is white; Mat binary; Mat distance tr; CvtColor (Frame, Black White, CV_BGR2GRAY); Gaussian Blur (Black White, Black White, Size (15,15), 6.5, 6.5); Threshold (Black White, Binary, 80, 255, CV_ DHRESH_BINARY); Mat ionberry = scalar (255) - binary; Distance Transform (Inbury, Distance TR, CVDISTSEL2, 3); And to reach pixel value, I created it:
for (int i = 0; i (0,0) == 0) {cout & lt; For the webcam show, I use
("project", distanceTr) As far as I know, distanceTr is a grayscale image, so this is a 1-channel image based on some answers, I tried. & Lt; & gt; But this does not workWaiting: (I'm doing a test case, if (0,0) pixel is black, then it will print 1. What I get is an unrestricted exception error. Can you give any help, please? < / p>
Thank you very much. (Sorry for the bad English)
Output image Is type CV_32FC1 , so each pixel type is float . To reach the pixel value, you have to do the following : if (distanceTr.at & lt; Float & gt; (0,0) == 0) {cout & lt; & Lt; 1;} , the description of each function parameter is given, such as the size and type of image etc.
Comments
Post a Comment