OpenCV - Access violation reading location "somewhere in highgui lib"
-
05-06-2023 - |
Domanda
got following code:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;
void captureAndThreshold();
int main() {
captureAndThreshold();
return 0;
}
void captureAndThreshold() {
VideoCapture cap(0);
if(!cap.isOpened()) // check if we succeeded
return;
Mat thresh, frame;
namedWindow("Example Feed",1);
while(true) {
cap >> frame;
if (!frame.empty()) {
cvtColor(frame, thresh, CV_BGR2GRAY);
threshold(thresh, thresh, 0, 255, CV_THRESH_OTSU);
imshow("Example Feed", frame);
}
if (waitKey(30) >= 0)
break;
}
cap.release();
}
This works on an other release of OpenCV. However, because I needed additional external libraries, I decided to compile the OpenCV libraries myself and include them. Doing so resulted in me having this error. What is wrong? Both versions of OpenCV use 2.4.8
Nessuna soluzione corretta
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow