Ask Your Question

Revision history [back]

OpenCL access violation with x64/MSVC2015

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?