Ask Your Question

Revision history [back]

I had to do this it to get it to run

//convert to stdlink text

        openFileDialog1->ShowDialog();
        fileName1 = openFileDialog1->FileName;
        //tostdString converts to std string see link ^^
        Mat src = imread(tostdString(fileName1));//, CV_LOAD_IMAGE_COLOR);
        cvtColor(src, src, CV_BGR2BGRA);
        HBITMAP hBit = CreateBitmap(src.cols, src.rows, 1, 32, src.data);

        Bitmap^ bmp = Bitmap::FromHbitmap((IntPtr)hBit);
        pictureBox1->Image = bmp;

        waitKey();