Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

the code you're trying to use, is from opencv1.0, long deprecated c-api, and no more available in opencv4

you have to use cv::Mat, and functions from the cv namespace now,

maybe like this (assuming you have a valid ptrGrabResult):

Mat img(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8U, ptrGrabResult->GetBuffer());
Mat proc;   
Canny(img, proc, 64, 128);  // Edge detection
imshow(s_szCvWindowNameSrc, img);    // Show camera image
imshow(s_szCvWindowNameProc, proc); // Show processed image
waitKey(50);    // To keep show cvShowImage

the code you're trying to use, is from opencv1.0, long deprecated c-api, and no more available in opencv4

you have to use cv::Mat, and c++ functions from the cv namespace now,

maybe like this (assuming you have a valid ptrGrabResult):

Mat img(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8U, ptrGrabResult->GetBuffer());
Mat proc;   
Canny(img, proc, 64, 128);  // Edge detection
imshow(s_szCvWindowNameSrc, img);    // Show camera image
imshow(s_szCvWindowNameProc, proc); // Show processed image
waitKey(50);    // To keep show cvShowImage