主题:opencv IplImage转IBitmap

admin 2018年12月08日 48

可以将opencv中的IplImage转化为SOUI中的IBitmap

SOUI::IBitmap* LoadFromIplImage(IplImage* pIplImage)
{
    cv::Mat image(pIplImage);
    cv::Mat dst;
    cvtColor(image, dst, CV_RGB2RGBA);
    IplImage* tmpIplImage;
    tmpIplImage = &IplImage(dst);

    SOUI::IBitmap *m_pObjBmp = NULL;
    GETRENDERFACTORY->CreateBitmap(&m_pObjBmp);
    m_pObjBmp->Init(tmpIplImage->width, tmpIplImage->height, tmpIplImage->imageData);
    return m_pObjBmp;
}