Ask Your Question
0

OpenCL access violation with x64/MSVC2015 [closed]

asked 2017-03-09 04:56:55 -0500

I'm a new user of openCV. Having built the .dlls on MSVC2015, targeting x64, I get the following error when trying to run a test program QuickView.exe.

#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
    if (argc != 2)
    {
        cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
        return -1;
    }
Mat image;
image = imread(argv[1], IMREAD_COLOR); // Read the file

if (image.empty()) // Check for invalid input
{
    cout << "Could not open or find the image" << std::endl;
    return -1;
}

namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.
imshow("Display window", image); // Show our image inside it.

waitKey(0); // Wait for a keystroke in the window
return 0;

}

The error I get is exception thrown at 0x000007FEDD58A32A (igdrcl64.dll) in QuickView.exe: 0xC0000005: Access violation reading location 0x0000000000000990.

I can apparently continue past the error with no ill effects.

The call stack is (with apologies for the line length)

igdrcl64.dll!000007feded1a32a() Unknown

igdrcl64.dll!000007feded17f4b() Unknown

igdrcl64.dll!000007fededa6567() Unknown

igdrcl64.dll!000007fededa227e() Unknown

igdrcl64.dll!000007fededa2447() Unknown

ntdll.dll!0000000077bf0dc2()    Unknown

ntdll.dll!0000000077bf21ba()    Unknown

KernelBase.dll!000007fefdccaa85()   Unknown

IntelOpenCL64.dll!000007fee23810bf()    Unknown

IntelOpenCL64.dll!000007fee236110b()    Unknown

OpenCL.dll!000007fee3b810cc()   Unknown

OpenCL.dll!000007fee3b83437()   Unknown

[External Code] 

OpenCL.dll!000007fee3b82d8c()   Unknown

opencv_core320d.dll!OPENCL_FN_clGetPlatformIDs_switch_fn(unsigned int p1, _cl_platform_id * * p2, unsigned int * p3) Line 466   C++

opencv_core320d.dll!cv::ocl::haveOpenCL() Line 1472 C++

opencv_core320d.dll!cv::ocl::useOpenCL() Line 1493  C++

opencv_core320d.dll!cv::flip(const cv::_InputArray & _src, const cv::_OutputArray & _dst, int flip_mode) Line 809   C++

opencv_core320d.dll!cvFlip(const void * srcarr, void * dstarr, int flip_mode) Line 1469 C++

opencv_imgcodecs320d.dll!cvConvertImage(const void * srcarr, void * dstarr, int flags) Line 679 C++

opencv_highgui320d.dll!cvShowImage(const char * name, const void * arr) Line 1158   C++

opencv_highgui320d.dll!cv::imshow(const cv::String & winname, const cv::_InputArray & _img) Line 308    C++

QuickView.exe!main(int argc, char * * argv) Line 27 C++

Obviously imshow is calling something deep within OpenCL that is giving a problem. The workarounds I have successfully tested are to compile OpenCV without OpenCL support (comment out line 124 in cvconfig.h), or to switch off Win32 Access Violation catching. However, neither of these seem very satisfactory. Can anyone suggest a proper remedy, please?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by LBerger
close date 2017-03-10 02:03:30.318926

Comments

1

first don't change cvconfig.h. if you want to disable opencl use

ocl::setUseOpenCL(false);

What is your graphic card?

LBerger gravatar imageLBerger ( 2017-03-09 05:27:59 -0500 )edit

Intel(R) HD Graphics 530 (on a Dell Precision 7510 laptop). Dell may have used a custom variant for them.

Anthony Huggett gravatar imageAnthony Huggett ( 2017-03-10 01:40:49 -0500 )edit

I think something is wrong in your configuration. Clean your solution in VS 2015 (all opencl kernels will be deleted) and rebuild opencv with opencl. Please don't change source code because it is difficult to help you. try to reproduce error using ocl::setUseOpenCL(false);

LBerger gravatar imageLBerger ( 2017-03-10 02:01:43 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-03-10 02:02:00 -0500

updated 2017-03-10 02:04:05 -0500

Updating the graphics driver has cured the problem. Thanks to LBerger for pointing me in the right direction.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-03-09 04:56:55 -0500

Seen: 784 times

Last updated: Mar 10 '17