OpenCV DirectX 11 Interoperability

asked 2020-06-13 14:29:37 -0500

10may gravatar image

I need to read an image in OpenCV, send it to DirectX, do some processing, and then send the output image back to OpenCV. I am completely new to this, and was working with DirectX 11, therefore, I decided to refer this sample which demonstrates OpenCV and DirectX interoperability. There are options for both GPU and CPU modes, but right now, I plan to use only the CPU. The program builds without any errors, but returns the following runtime error everytime:

Exception thrown at 0x0000000000000000 in Direct3D Win32 my_project_name.exe: 0xC0000005: Access violation executing location 0x0000000000000000. occurred

I looked for solutions everywhere but couldn't find any. Since this is a sample, I guess many people might have used this. Here are the lines where I'm getting an exception.

if (cv::ocl::haveOpenCL())
    {
        m_oclCtx = cv::directx::ocl::initializeContextFromD3D11Device(m_pD3D11Dev); //this is the line which throws the exception
    }

    m_oclDevName = cv::ocl::useOpenCL() ?
        cv::ocl::Context::getDefault().device(0).name() :
        "No OpenCL device";

On hovering the cursor above m_pD3D11Dev, this message is displayed by the intellisense:

m_pD3D11Dev | 0x000001f5a286c618 <No type information available in symbol file for d3d11.dll>

I am guessing that there is some error in my setup or some other linker error since this is a sample code provided by OpenCV(which i am assuming is obviously going to run). Any help or guidance would be appreciated.

I'm using DirectX 11 and OpenCV 3.4.4 to build(x64) this in Visual Studio 19. I also tried building(x64) it in Visual Studio 17, but the results were same.

Thanks in advance.

edit retag flag offensive close merge delete

Comments

Have you considered using OpenGL? I can help you with that, but sorry I've not used DirectX since version 9.

sjhalayka gravatar imagesjhalayka ( 2020-06-13 16:32:48 -0500 )edit

P.S. You might have better luck asking on Gamedev.net.

sjhalayka gravatar imagesjhalayka ( 2020-06-13 16:34:12 -0500 )edit