資料來源: display cv::Mat (opencv 2.4.3) in pictureBox (Visual C++ 2010)

Mat img;

openFileDialog1->Filter = "JPEG files (*.jpg)|*.jpg|Bitmap files (*.bmp)|*.bmp";
if(openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{

img = imread(openFileDialog1->FileName, CV_LOAD_IMAGE_COLOR);

System::Drawing::Graphics^ graphics = pictureBox1->CreateGraphics();
System::IntPtr ptr(img.ptr());
System::Drawing::Bitmap^ b  = gcnew System::Drawing::Bitmap(img.cols,img.rows,img.step,System::Drawing::Imaging::PixelFormat::Format24bppRgb,ptr);
System::Drawing::RectangleF rect(0,0,pictureBox1->Width,pictureBox1->Height);
graphics->DrawImage(b,rect);

}

資料來源: C++/CLI Converting from System::String^ to std::string

#include <msclr/marshal_cppstd.h>

System::String^ xyz="Hi boys";

std::string converted_xyz = msclr::interop::marshal_as< std::string >( xyz );


 

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 me1237guy 的頭像
    me1237guy

    天天向上

    me1237guy 發表在 痞客邦 留言(0) 人氣()