文章出處

    cv::Mat leftMat,rightMat,depthMapMat;
    UIImageToMat(leftImage, leftMat);
    UIImageToMat(rightImage, rightMat);
    if (leftMat.type()>0) {
        cv::cvtColor(leftMat,leftMat,cv::COLOR_RGB2GRAY);
    }
    if (rightMat.type()>0) {
          cv::cvtColor(rightMat,rightMat,cv::COLOR_RGB2GRAY);
    }
    //int numDisparities = 0, int blockSize = 21
    cv::Ptr<cv::StereoBM> sbm = cv::StereoBM::create(32,21);
    sbm->compute(leftMat, rightMat, depthMapMat);
    depthMapMat.convertTo(depthMapMat,CV_8UC1);


    UIImage *depthMapImage=MatToUIImage(depthMapMat);
    leftMat.release();
    rightMat.release();
    depthMapMat.release();
 

文章列表




Avast logo

Avast 防毒軟體已檢查此封電子郵件的病毒。
www.avast.com


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()