if I use UMat , it is giving exception error

asked 2019-01-02 00:20:08 -0500

nobot gravatar image

if I use UMat , it is giving exception error terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(3.4.2) /home/u-16i/softwares/opencv/opencv/modules/core/src/matrix_wrap.cpp:1731: error: (-215:Assertion failed) k == MAT in function 'getMatRef',but with Mat type, the code is having no issues. Any reason??

Mat src_mat;
UMat src_umat,resized,res;

float inputMIN= 0.1f;
float inputMAX= 0.1f;
float outputMIN= 0.1f;
float outputMAX= 0.1f;
float pcent_topbybottom =0.01f;
src_mat = imread("/home/u-16i/Pictures/wp/beach_flowers-wallpaper-1440x900.jpg");
if (src_mat.empty())
{
    printf("Cannot read image file");
    return -1;
}
src_mat.copyTo(src_umat);
resize(src_umat, resized, Size(), .29, 0.29, CV_INTER_AREA);
imshow("b4 white balance", resized);

Ptr<xphoto::SimpleWB> wb =xphoto::createSimpleWB();
inputMAX=wb->getInputMax();
cout<<"inputMAX-->\t"<<inputMAX<<endl;
inputMIN=wb->getInputMin();
cout<<"inputMIN-->\t"<<inputMIN<<endl;
outputMIN=wb->getOutputMin();
cout<<"outputMIN-->\t"<<outputMIN<<endl;
outputMAX=wb->getOutputMax();
wb->setP(4.2);
cout<<"outputMAX-->\t"<<outputMAX<<endl;
pcent_topbybottom =wb->getP();
cout<<"pcent_topbybottom-->\t"<<pcent_topbybottom<<endl;

wb->balanceWhite(resized, res);
    imshow("after white balance", res);

waitKey(0);
return 0;

even though if change line-2

UMat src_umat,resized,res -> Mat src_umat,resized,res

everything works fine.

edit retag flag offensive close merge delete

Comments

Yes it's not possibe to use UMat in balanceWhite

It's not possible to get a reference on Umat object

I think you can post an issue

LBerger gravatar imageLBerger ( 2019-01-02 02:00:32 -0500 )edit

ok, thank you.

nobot gravatar imagenobot ( 2019-01-02 03:31:52 -0500 )edit