Exception using UMat

asked 2015-08-11 14:17:07 -0600

LBerger gravatar image

updated 2015-08-11 14:21:05 -0600

Hi,

I've got a system exception using following code when ocl::setUseOpenCL(true);. Can you check it?

Thanks in advance

#include <opencv2/opencv.hpp> 
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/core/ocl.hpp"
#include <iostream>
#include <map>
#include <fstream>
using namespace cv;
using namespace std;

int main(int argc, char **argv)
{
UMat imUMat = UMat::zeros(256,256, CV_8U);  // type of mask is CV_8U
Mat imMat = Mat::zeros(256,256, CV_8U);  // type of mask is CV_8U
Rect r(0,0,10,10);
imMat(r) = 255;
imUMat(r) = 255;
r = Rect(0,0,0,0);
imMat(r) = 255;
ocl::setUseOpenCL(false);
imUMat(r) = 255;
ocl::setUseOpenCL(true);
imUMat(r) = 255;
return 0;
 }

videoio: Removing WinRT API headers by default

General configuration for OpenCV 3.0.0-dev ===================================== Version control: 3.0.0-65-g945aa06

Platform: Host: Windows 6.2 AMD64 CMake: 3.3.0-rc1 CMake generator: Visual Studio 12 2013 Win64 CMake build tool: C:/Program Files (x86)/MSBuild/12.0/bin/MSBuild.exe MSVC: 1800

Other third-party libraries: Use IPP: 8.2.1 [8.2.1] at: F:/lib/opencv/3rdparty/ippicv/unpack/ippicv_win Use IPP Async: NO Use Eigen: NO Use Cuda: NO Use OpenCL: YES

OpenCL: Version: dynamic Include path: F:/lib/opencv/3rdparty/include/opencl/1.2 Use AMDFFT: NO Use AMDBLAS: NO


edit retag flag offensive close merge delete

Comments

The code

ocl::setUseOpenCL(false);
imUMat(r) = 255;

will never run, because you prohibit the use of the OpenCL context, which is needed to use UMat structures. So it is normal this yields exceptions...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-08-12 04:32:05 -0600 )edit

No exception occurs here :

r = Rect(0,0,0,0);
ocl::setUseOpenCL(true);
imUMat(r) = 255;
return 0;

problem is when r is empty.

About your remark I don't understand I have read this document and at page 21 I understand when you disable opencl function is still called with old function.

May be you talk about UMat is declared and there is no opencl available but here I have got an opencl device available.

Can you test program?

LBerger gravatar imageLBerger ( 2015-08-12 14:30:24 -0600 )edit