简体   繁体   中英

OpenCV filter2D : Is there any use of kernels not anchored at center?

I'm currently working on convolution in OpenCV using filter2D function. Almost always I've found the kernel anchored at the center (using the default value of anchor = (-1,-1)).

Are there cases when the kernel needs to be anchored away from the center? What are the benefits of doing so, if any?

There are similar posts on SE ( post 1 , post 2 ) but I couldn't get my answer.

Yes. Mostly if you're using a non-symmetric kernel.

Most of the time people use a kernel that's either a square, a circle, or a Gaussian. In these cases you probably want the anchor to be in the centre.

But there are other uses to filter2D - trying to find the location of certain artefacts. In those cases - the artefact can be located to the, eg, left of the interesting point. In that case the anchor will be to the right of the kernel (and the kernel will be similar to the artefact you're looking for)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM