Ask Your Question
0

I sometimes get the below access violation error when running any of my OpenCV programs such as the simple one below.

asked 2017-01-27 05:15:02 -0500

I get this error: Exception thrown at 0x00007FF84AFAA74A (igdrcl64.dll) in OpenCV3_Template.exe: 0xC0000005: Access violation reading location 0x0000000000000994.

Here is my code, it is just a very simple program I made to demo the problem, it should just display the image.

This code sometimes runs fine and sometimes gives me the above error, can anyone help?

#include "opencv2\opencv.hpp"

using namespace cv;

int main(int argv, char** argc)
{
    Mat test = imread("McLaren P1 Bahrain-773-crop5184x2670.jpg", CV_LOAD_IMAGE_UNCHANGED);
    imshow("test", test);

    waitKey();
}
edit retag flag offensive close merge delete

Comments

Is the path of the image correct? Maybe you do not have permission to read image file.

Pedro Batista gravatar imagePedro Batista ( 2017-01-27 05:35:17 -0500 )edit
LBerger gravatar imageLBerger ( 2017-01-27 07:53:49 -0500 )edit

Just a small remark, reading images with spaces in its name is asking for issues. It is OS dependant behaviour so you should avoid it at all costs.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-01-28 08:27:50 -0500 )edit
1

LBerger Thanks, working today but drivers have updated!

David Wassell gravatar imageDavid Wassell ( 2017-01-31 10:37:55 -0500 )edit

I had a same problem. I use nvidia graphic card, and intel graphic is integrated card in processor. Solution: I removed igdrcl64.dll from Windows/system32 and imshow in opencv doesn't have a problem now. ;-)

Grims gravatar imageGrims ( 2017-03-29 02:46:11 -0500 )edit

which is your computer ?

LBerger gravatar imageLBerger ( 2017-03-29 03:02:05 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-01-30 08:37:52 -0500

pi-null-mezon gravatar image

I do not know why exeption is thrown, but suggest to call waitKey in the right way:

#include "opencv2\opencv.hpp"    
using namespace cv;    
int main(int argv, char** argc)
{
    Mat test = imread("McLaren P1 Bahrain-773-crop5184x2670.jpg", CV_LOAD_IMAGE_UNCHANGED);
    imshow("test", test);
    while(true)  {
      char option = waitKey(1); // wait 1 ms before waitKey will return value
      if(option = 27) // 27 is ESCAPE code from the ASCII table
          break; // break loop if the user has pressed escape button 
    }
    return 0;
}
edit flag offensive delete link more

Comments

Why do you mean in the right way ?

LBerger gravatar imageLBerger ( 2017-01-30 08:41:53 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-01-27 05:15:02 -0500

Seen: 746 times

Last updated: Jan 30 '17