Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.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 Mat对象加载到标签中?_C++_Visual Studio 2010_Opencv_User Interface_Command Line Interface - Fatal编程技术网

C++ 如何将OpenCV Mat对象加载到标签中?

C++ 如何将OpenCV Mat对象加载到标签中?,c++,visual-studio-2010,opencv,user-interface,command-line-interface,C++,Visual Studio 2010,Opencv,User Interface,Command Line Interface,如何将opencv Mat图像对象设置为C++/CLI标签?我试过以下方法 Mat image = imread("C:/Users/Public/Pictures/Sample Pictures/Desert.jpg"); imageLabel->BackgroundImage = image; 但它只是在产生错误 Error 1 error C2664: 'void System::Windows::Forms::Control::BackgroundImage::set

如何将opencv Mat图像对象设置为C++/CLI标签?我试过以下方法

 Mat image = imread("C:/Users/Public/Pictures/Sample Pictures/Desert.jpg");
 imageLabel->BackgroundImage = image;
但它只是在产生错误

Error   1   error C2664: 'void System::Windows::Forms::Control::BackgroundImage::set(System::Drawing::Image ^)' : cannot convert parameter 1 from 'cv::Mat' to 'System::Drawing::Image ^'   c:\users\yohan\documents\visual studio 2010\projects\opencvfinaltest\opencvfinaltest\Form1.h    144 1   OpenCVFinalTest

有什么想法吗?

你犯了什么错误?@praks411:谢谢你的回复。请参阅更新。我认为您不能直接将图像分配给imageLabel->BackgroundImage。这两个是不同的,您需要将Mat转换为图像。我认为图像是位图图像,所以您需要将Mat图像转换为位图。然后,您的工作是完全理解这两个对象,并提供自定义“=”运算符。