BinaryFunc type in new version of OpenCv is missing

asked 2018-05-31 00:53:45 -0600

DavidS gravatar image

updated 2018-05-31 01:05:22 -0600

berak gravatar image

I have some project which was wriiten in OpenCV 2.4.x and I migrated it to version 3.4.1. I am nearly at the end of my work but in the sources data type BinaryFunc is used and method

CV_EXPORTS BinaryFunc getConvertFunc(int sdepth, int ddepth)

too. In old version they are placed in core.hpp file. But in version 3.4.1 they are not available. I found them in another header file but it is only "internal file of OpenCv". Any idea how to rewrite the code to work with new version of OpenCV?

Old core.hpp :

typedef void (*BinaryFunc)(const uchar* src1, size_t step1,
                           const uchar* src2, size_t step2,
                           uchar* dst, size_t step, Size sz,       void*);
CV_EXPORTS BinaryFunc getConvertFunc(int sdepth, int ddepth);
CV_EXPORTS BinaryFunc getConvertScaleFunc(int sdepth, int ddepth);
CV_EXPORTS BinaryFunc getCopyMaskFunc(size_t esz);

This is not present in new core.hpp.

edit retag flag offensive close merge delete

Comments

what is the context ? what do you need it for ?

can you show, how you used it in the old 2.4 code ?

berak gravatar imageberak ( 2018-05-31 01:06:56 -0600 )edit

Context (It is not my code. This code I inherited) :

In some class:

BinaryFunc cvtfunc;

In constructor of this class:

cvtfunc = src->depth() != CV_32F ? getConvertFunc(src->depth(), CV_32F) : 0;

In some method of this class:

`        for( int y = y0; y < y1; y++ )
        {
            const float* data = buf;
            if( cvtfunc )
                cvtfunc( src->ptr(y), src->step, 0, 0, (uchar*)data, 0, Size(ncols*nchannels, 1), 0);
            else
                data = src->ptr<float>(y);`
DavidS gravatar imageDavidS ( 2018-05-31 02:16:44 -0600 )edit