For medianblur you aren't allowed to have ksize values larger than 255?

asked 2014-06-12 15:03:01 -0500

I'm working images that have 10k X 10k dimensions. To account for this I need to use an aperture window size that's 1001 by 1001. I noticed that this isn't actually possible... entering a value greater than 255 causes this assert to fail... this is inside of ...opencv\sources\modules\imgproc\src\smooth.cpp.

#if MEDIAN_HAVE_SIMD
            if( useSIMD )
            {
                for( j = 0; j < 2*r; ++j )
                    histogram_add_simd( &h_coarse[16*(n*c+j)], H[c].coarse );

                for( j = r; j < n-r; j++ )
                {
                    int t = 2*r*r + 2*r, b, sum = 0;
                    HT* segment;

                    histogram_add_simd( &h_coarse[16*(n*c + std::min(j+r,n-1))], H[c].coarse );

                    // Find median at coarse level
                    for ( k = 0; k < 16 ; ++k )
                    {
                        sum += H[c].coarse[k];
                        if ( sum > t )
                        {
                            sum -= H[c].coarse[k];
                            break;
                        }
                    }
                    assert( k < 16 );

Is there anyway around this or am I limited to using window sizes 255 and under in OpenCV? If there isn't then that's a pretty big flaw on part of OpenCV. I have a personal java implementation of medianblur that can take window sizes of any size I don't understand why OpenCV works any differently...

edit retag flag offensive close merge delete

Comments

How do you know it is limited to 255? I'm having trouble with this too. I want to use large kernel size, like 301 or even more. But sometime it's fail because of the assertion.

agentslx gravatar imageagentslx ( 2019-05-05 21:34:59 -0500 )edit

I'm being limited with Ksize of 16. and I know this because the error specifies that value of K should be less then 16. So why is that limit there?

sagarsutar_ gravatar imagesagarsutar_ ( 2020-08-10 14:04:23 -0500 )edit