c++ - Strange error with cuda::reprojectImageTo3D and OpenCV 3.0 -
hello trying mat xyz cordenates disparity map have generated cuda::stereobm object, screenshot of disparity map created "disparity map" when add function cuda::reprojectimageto3d(d_disp,d_xyz,d_q,3,stream); error can't understand, if coment line of code no error shown moment try use function next error window
and error code is:
opencv error: function/feature not implemented (you should explicitly call download method cuda::gpumat object) in cv::_inputarray::getmat_, file c:\opencv\sources\modules\core\src\matrix.cpp, line 1211
bellow code, note of mats declared global , declarations not in slot function
void mainwindow::on_botonmostrardispsgbmcuda_clicked() { if(map_l1.empty()&&map_l2.empty()&&map_r1.empty() &&map_r2.empty()){ filestorage fs(xmlname,filestorage::read); fs["map_l1"]>>map_l1; fs["map_l2"]>>map_l2; fs["map_r1"]>>map_r1; fs["map_r2"]>>map_r2; fs["q"] >> q; fs.release(); } mat img1, img2; img1 = imread("c:\\users\\diego\\pictures\\calibstereo\\camleft\\photoleft_1.jpg"); img2 = imread("c:\\users\\diego\\pictures\\calibstereo\\camright\\photoright_1.jpg"); cvtcolor(img1, framelgray, cv_bgr2gray); cvtcolor(img2, framergray, cv_bgr2gray); remap(framelgray,framel_rect,map_l1,map_l2,inter_linear); remap(framergray,framer_rect,map_r1,map_r2,inter_linear); bool ok1, ok2, ok3, ok4, ok5, ok6 , ok7,ok8,ok9,ok10 ; int prefiltersize = ui->editprefiltersizebm->text().toint(&ok1); int prefiltercap = ui->editfiltercapbm->text().toint(&ok2); int blocksize = ui->editblocksbm->text().toint(&ok3); int mindisp = ui->editmindispbm->text().toint(&ok4); int numdisp = ui->editnumdispbm->text().toint(&ok5); int texturethresh = ui->edittexturebm->text().toint(&ok6); int uniqueness = ui->edituniquenesbm->text().toint(&ok7); int specklewindow = ui->editspecklewindowbm->text().toint(&ok8); int specklerange = ui->editspecklerangebm->text().toint(&ok9); int maxdiff = ui->editmaxdiffbm->text().toint(&ok10); if (!ok1 || !ok2 || !ok3 || !ok4 || !ok5 || !ok6 || !ok7 || !ok8 || !ok9 || !ok10){ qmessagebox messagebox; messagebox.seticonpixmap(qpixmap(":/icon.svg")); messagebox.settext("one of entries not valid number."); messagebox.setwindowtitle("error"); messagebox.exec(); } d_left.upload(framel_rect); d_right.upload(framer_rect); ptr<cuda::stereobm> cusbm; cusbm = cuda::createstereobm(64, 5); cusbm->setprefiltersize(prefiltersize); cusbm->setprefiltercap(prefiltercap); cusbm->setblocksize(blocksize); cusbm->setmindisparity(mindisp); cusbm->setnumdisparities(numdisp); cusbm->settexturethreshold(texturethresh); cusbm->setuniquenessratio(uniqueness); cusbm->setspecklewindowsize(specklewindow); cusbm->setspecklerange(specklerange); cusbm->setdisp12maxdiff(maxdiff); cuda::stream mystream = cuda::stream::stream(); cusbm->compute(d_left, d_right, d_disp, mystream); if(!d_disp.empty()){ cuda::gpumat d_xyz(d_disp.size(), cv_32fc4); cuda::gpumat d_q(4,4,cv_32f); d_q.upload(q); cuda::stream mysecondstream = cuda::stream::stream(); cuda::reprojectimageto3d(d_disp,d_xyz,d_q,3,mysecondstream); d_xyz.download(xyz); } cuda::drawcolordisp(d_disp, d_disp,numdisp); //64 d_disp.download(disp); namedwindow("left"); namedwindow("right"); namedwindow("disp"); imshow("left", framel_rect); imshow("right", framer_rect); imshow("disp", disp); //imshow("xyz", xyz); waitkey(0); cv::destroyallwindows(); }
i using windows 8.1, qtcreator ide, opencv 3.0.0 cuda 7.0
are sure d_disp
in line cuda::reprojectimageto3d(d_disp,d_xyz,d_q,3,mysecondstream);
gpumat
your problem may cv::mat
class, has no overloaded assignment operator or copy constructor takes argument of type cv::gpu::gpumat
, not able mix them in code.
Comments
Post a Comment