Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/162.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 未显示OpenCv图像_C++_Visual Studio 2010_Opencv - Fatal编程技术网

C++ 未显示OpenCv图像

C++ 未显示OpenCv图像,c++,visual-studio-2010,opencv,C++,Visual Studio 2010,Opencv,请看一下下面的代码 #include <opencv2\core\core.hpp> #include <opencv2\highgui\highgui.hpp> #include <iostream> using namespace std; using namespace cv; int main() { Mat image; try { image = imread("C:/Users/Public/Pict

请看一下下面的代码

#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <iostream>

using namespace std;
using namespace cv;

int main()
{
    Mat image;

    try
    {
        image = imread("C:/Users/Public/Pictures/Sample Pictures/Chrysanthemum.jpg");

        if(!image.data)
        {
            throw 1;
        }

        cout << "Height: " << image.size().height << " Width: " << image.size().width << endl;
    }
    catch(int error)
    {
        cout << "This message does not exists" << endl;
        exit(0);
    }

    namedWindow("Image 1");
    imshow("Image 1",image);


    system("pause");
    return 0;
}
#包括
#包括
#包括
使用名称空间std;
使用名称空间cv;
int main()
{
Mat图像;
尝试
{
image=imread(“C:/Users/Public/Pictures/Sample Pictures/jummy.jpg”);
如果(!image.data)
{
投掷1枚;
}

不能你需要让窗口刷新。 系统(“暂停”)不执行此操作。 opencv等价物是 等待键(0)