Ask Your Question
1

Blue Screen while runing OpenCV 3.1 mini-application.

asked 2016-01-12 12:00:20 -0600

Djangoum gravatar image

Hi everybody ! :)

I'm having several problems to run my OpenCV based projects on my computer. I'm using OpenCV 3.1.0 with Visual Studio 2015 so i'm using vc14 .lib and .dll. The official web page of OpenCV says that 3.1.0 has Visual Studio 14 2015 support so i don't think that this is the problem.

The code i'm runing is this :

enter code here
#include<stdio.h>
#include<math.h>
#include<opencv\cv.h>
#include<opencv\highgui.h>
#include<opencv2\objdetect\objdetect.hpp>
#include<opencv2\highgui\highgui.hpp>
#include<opencv2\imgproc\imgproc.hpp>
#include<vector>

using namespace cv;
using namespace std;

int main()
{
       CascadeClassifier face_cascade, eye_cascade;
   if (!face_cascade.load("haarcascade_frontalface_alt.xml")) {
    printf("Error loading cascade file for face");
    return 1;
}
if (!eye_cascade.load("haarcascade_eye.xml")) {
    printf("Error loading cascade file for eye");
    return 1;
}
VideoCapture capture(0); //-1, 0, 1 device id
if (!capture.isOpened())
{
    printf("error to initialize camera");
    return 1;
}
Mat cap_img, gray_img;
vector<Rect> faces, eyes;
while (1)
{
    capture >> cap_img;
    waitKey(10);
    cvtColor(cap_img, gray_img, CV_BGR2GRAY);
    cv::equalizeHist(gray_img, gray_img);
    face_cascade.detectMultiScale(gray_img, faces, 1.1, 10, CV_HAAR_SCALE_IMAGE | CV_HAAR_DO_CANNY_PRUNING, cvSize(0, 0), cvSize(300, 300));
    for (int i = 0; i < faces.size(); i++)
    {
        Point pt1(faces[i].x + faces[i].width, faces[i].y + faces[i].height);
        Point pt2(faces[i].x, faces[i].y);
        Mat faceROI = gray_img(faces[i]);
        eye_cascade.detectMultiScale(faceROI, eyes, 1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30));
        for (size_t j = 0; j< eyes.size(); j++)
        {
            //Point center(faces[i].x+eyes[j].x+eyes[j].width*0.5, faces[i].y+eyes[j].y+eyes[j].height*0.5);
            Point center(faces[i].x + eyes[j].x + eyes[j].width*0.5, faces[i].y + eyes[j].y + eyes[j].height*0.5);
            int radius = cvRound((eyes[j].width + eyes[j].height)*0.25);
            circle(cap_img, center, radius, Scalar(255, 0, 0), 2, 8, 0);
        }
        rectangle(cap_img, pt1, pt2, cvScalar(0, 255, 0), 2, 8, 0);
    }
    imshow("Result", cap_img);
    waitKey(3);
    char c = waitKey(3);
    if (c == 27)
        break;
}
return 0;
}

It's just an example that i found on the internet.

Please i really want to learn about OpenCV but i can't run anything :(

I'm using Windows 8.1

image description

Thank everybody :) I wish i could help in the future!

edit retag flag offensive close merge delete

Comments

I'm getting this problem too with example code to just simply load and display an image in a named window. For me I get this same BSOD error when I hit a key to close the program (with waitkey(0)). BSOD are usually hardware/driver related, so right now I'm reinstalling my graphics driver to see if it'll fix the problem. Check if any of your drivers are out of date, it might be the problem. Good luck!

sebaqu11 gravatar imagesebaqu11 ( 2016-01-12 22:24:13 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-01-12 23:46:31 -0600

sebaqu11 gravatar image

I solved this problem on my end, my laptop has a dedicated nvidia chip, the 940m. In my case, the latest driver was causing it to bsod, I uninstalled the driver, restarted the laptop, and now it doesn't bsod anymore. Hopefully this works for you too. Good luck.

edit flag offensive delete link more

Comments

Thanks for the awnser ! What driver do you used to have ? Updated from Nvidia Geforce Xperience ? I just reinstaled windows 10 and it's not happening now but may if i install the lastest driver it crashes. I wont just in case. Thanks a lot ^^

Djangoum gravatar imageDjangoum ( 2016-01-14 22:00:45 -0600 )edit

Thank you solved the problem for me. I disabled my GTX970m driver (361.43) on Win 10.1 x64 as you advised. Thank you very very much !

fahdovski gravatar imagefahdovski ( 2016-01-22 19:21:21 -0600 )edit

Same problem here. Do you mean that I need to keep my GTX970m driver uninstalled if I want to use openCV 3.1.0? Did you report this issue?

Finfa811 gravatar imageFinfa811 ( 2016-02-16 04:50:33 -0600 )edit

@fahdovski with the new version (361.91) the problem is solved for me, so no more need to uninstall the driver

Finfa811 gravatar imageFinfa811 ( 2016-02-16 08:01:26 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2016-01-12 12:00:20 -0600

Seen: 771 times

Last updated: Jan 12 '16