Ask Your Question
0

Issue Using OpenCV 4 Windows Build, VS 2017 - Unhandled Exception with imshow()

asked 2018-11-30 19:10:39 -0600

geolec gravatar image

updated 2018-11-30 22:32:58 -0600

Hello everyone, I'm running into a big problem just trying to setup OpenCV again in my IDE with the latest version for Windows. I've done this before in earlier versions successfully, but I'm stumped this time around. I extracted the files from the downloaded .exe, added the paths to my environmental variables and setup my properties sheet properly for debug x64. However, when I implement this simple test script to see if everything is connected correctly:


#include "opencv2/opencv.hpp"

using namespace std;
using namespace cv;

int main()
{
    Mat A;
    A = Mat::zeros(100, 100, CV_32F);

    imshow("x", A);
    //waitKey(0); 
    return 0;
}

program halts on the imshow() line and my Call Stack reports:


KernelBase.dll!...
vcruntime140d.dll!...
opencv_world400d.dll!cv::Error(...
opencv_world400d.dll!cvShowImage(...
opencv_world400d.dll!cvimshow(...
The ellipses are because I don't think I need to write out all the functions parameters.

And I have tried unpacking the libraries again. Thank you!

Followup Info:

I just built my own version from the source using CMake, and I am still getting the same issue, where KernelBase.dll is the farthest I get on the Call Stack before everything falls apart.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-11-30 22:49:09 -0600

berak gravatar image

updated 2018-11-30 22:49:35 -0600

unfortunately, that's a bug in the library , (not your fault).

it was fixed here so, another pull and rebuild.

in the meantime, you may convert yourimage manually before using imshow():

 img.convertTo(img, CV_8U, 255);
edit flag offensive delete link more

Comments

Thank you! I just spent the last hour trying to restore windows files on the off chance something was corrupt! That worked perfectly.

geolec gravatar imagegeolec ( 2018-11-30 22:51:37 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-30 19:10:39 -0600

Seen: 540 times

Last updated: Nov 30 '18