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;
}