Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

cuda::meanShiftSegmentation - Assertion Failed Error

$
0
0
Hi. I'm new to using CUDA with OpenCV so this might be a very simple error but I'm kinda stuck. My code is the following: #include #include #include #include #include using namespace cv; int main( int argc, char** argv ) { Mat pictureBGR; Mat pictureSegment; cuda::GpuMat bgr; cuda::GpuMat convertedBgr; cuda::GpuMat dstBgr; std::cout << cuda::getCudaEnabledDeviceCount() << std::endl; pictureBGR = imread("2.jpg"); //unos slike za pretragu if(!pictureBGR.data) { std::cout << "Gre\u0161ka pri u\u010ditavanju slike!" << std::endl; return -1; } bgr.upload(pictureBGR); cuda::cvtColor(bgr, convertedBgr, CV_BGR2BGRA); TermCriteria criteria(CV_TERMCRIT_EPS, 0, 0.08); cuda::meanShiftSegmentation(convertedBgr, dstBgr, 20, 20, 3, criteria); dstBgr.download(pictureSegment); namedWindow("Display Image", CV_WINDOW_AUTOSIZE); imshow("Display Image", pictureSegment); waitKey(0); return 0; } And i'm getting the following error: Assertion failed (src.type() == CV_8UC4) in meanShiftSegmentation, file /home/zburazin/opencv-3.0.0/modules/cudaimgproc/src/mssegmentation.cpp, line 229 terminate called after throwing an instance of 'cv::Exception' what(): /home/zburazin/opencv-3.0.0/modules/cudaimgproc/src/mssegmentation.cpp:229: error: (-215) src.type() == CV_8UC4 in function meanShiftSegmentation I understand that the meanShiftSegmentation only takes GpuMat of type 8UC4, but I am still to find a solution to convert it. Any ideas? std::cout << cuda::getCudaEnabledDeviceCount() << std::endl; returns 1 btw.

Viewing all articles
Browse latest Browse all 41027

Trending Articles