What is problem? [closed]
I started learning opencv and faced such a problem. When I load an ordinary picture and try to bring it to the screen, two windows are created in one image and in the other just a window with a gray background. If I use the C version, then everything works well (one window is created in which this image is located) What can be the problem. I downloaded the image download code from the documentation and in the example they create one window with a picture. Version of OpenCV 3.4
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat image = imread("image.jpg");
if (!image.data)
{
cout << "Could not open or find the image" << std::endl;
cv::waitKey(5000);
return -1;
}
namedWindow("Display window", WINDOW_AUTOSIZE);
imshow("Display window", image);
waitKey();
system("pause");
return 0;
}
" If C version, then everything works well " -- oh dear, please check your linker settings, thrice.
most likely, you're using debug libs with a release build, or the other way round (or, hell, -- even both)
хахахахаха I really used both of them. I connected as it is written on the Internet
yea, just don't. use release libs with your release project, and debug libs with your debug project., but never both.
the "long answer" (if you want to know) is:
release and debug libs have differnt vtables for the std:: classes (think: vector or string). if you mismatch those, your program is essentially doing "undefined behaviour", anything (including the infamous "nasal demons") might happen !
Yes, I understand, I made a mistake when I set up. Did not put in the studio the meaning of "all configurations"