Potentially incorrect lower limit of kernel size for DFT filtering in documentation

Lower limit of kernel size for filter2D from the documentation is :

The function uses the DFT-based algorithm in case of sufficiently large kernels (~11 x 11 or larger) and the direct algorithm (that uses the engine retrieved by createLinearFilter() ) for small kernels.

However, this line states that the above mentioned lower limit is only for SSE3 CPUs (due to the presence of CV_CPU_SSE3 flag), the limit seems to be 9x9 for rest of the hardware systems. I have tested this on a machine supporting AVX 512 and observed that DFT was used in filter2D once the kernel size became 9x9.

1 Like

Hi @prathamesh_tagore

You are right. Although that link goes to old docs from version 2.4, the actual doc link says the same thing.

From that line you mention, I believe the limits are near 7x7 and 11x11, depending on your hardware.

The reference intentionally doesn’t document the exact limit.

1 Like

The reference intentionally doesn’t document the exact limit.

Do you think docs should mention this dependency of DFT kernel size threshold on underlying hardware? I’ll be happy to create a PR for the same.

@prathamesh_tagore

I think this isn’t about how to use the function, but an indication on how it works. I don’t think programmers should update the docs if they change the algorithm selection criteria.

If someone wonders how it works, he can inspect the code like you did.

That’s my opinion.