Ask Your Question

Revision history [back]

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

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...