Ask Your Question
0

opencv exception in abs function [closed]

asked 2017-05-08 10:38:46 -0600

aligoglos gravatar image

i want use abs function but every time i use it a type of exception occur !! once this exception :

Exception thrown: read access violation.

on below code in ocl.cpp line 4 :

bool useOpenCL()
{
    CoreTLSData* data = getCoreTlsData().get();
    if( data->useOpenCL < 0 )
    {
        try
        {
            data->useOpenCL = (int)haveOpenCL() && Device::getDefault().ptr() && Device::getDefault().available();
        }
        catch (...)
        {
            data->useOpenCL = 0;
        }
    }
    return data->useOpenCL > 0;
}

other this :

A heap has been corrupted .

on below code in alloc.cpp line 3:

void* fastMalloc( size_t size )
{
    uchar* udata = (uchar*)malloc(size + sizeof(void*) + CV_MALLOC_ALIGN);
    if(!udata)
        return OutOfMemoryError(size);
    uchar** adata = alignPtr((uchar**)udata + 1, CV_MALLOC_ALIGN);
    adata[-1] = udata;
    return adata;
}

another exception :

A heap has been corrupted  (ntdll.dll).

on opencl_core.cpp line 110 : handle = LoadLibraryA(path);

I am totally confused please help.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by LBerger
close date 2017-05-09 00:26:36.597950

Comments

Where is abs called?

LBerger gravatar imageLBerger ( 2017-05-08 11:23:22 -0600 )edit

in my function get Mat image : imtemp2 = cv::abs(im);

aligoglos gravatar imagealigoglos ( 2017-05-08 11:52:11 -0600 )edit

opencl.dll cannot be found in your system. disable opencl in your main function :setUseOpencl(false);

LBerger gravatar imageLBerger ( 2017-05-08 11:59:02 -0600 )edit

but i don't use With_opencl when i compiled.

aligoglos gravatar imagealigoglos ( 2017-05-08 22:37:26 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-05-08 22:52:19 -0600

aligoglos gravatar image

I'm sorry I was wrong. i use im.ptr<float>(i)[j] but my Mat type is CV_8UC. i convert my Mat to CV_32F and use im.at<float>(i,j), fixed issue.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-05-08 10:38:46 -0600

Seen: 2,301 times

Last updated: May 08 '17