# is there a use for a changing kernel in image convolution

I understand the principle of image convolution. Maybe. I think it is this:

You use a small matrix with numbers in it,

then take a sample of an image with as many pixels as you have numbers in your matrix,

then do a dot product, then add up all the terms and

then use the result as the new value for the pixel located in the center of your image sample.

Now, my question is this:

Does it make sense to think about an image kernel for convolution whose values actually depend on the image? For example, consider a 'sharpen' kernel:

0 1 0
1 4 1
0 1 0


I want to change the value in the center to be a number between 1 and 5 depending on the brightness of the pixel which is two places to the left.

The reason I ask this is because I've noticed that when I look at an image, I actually look at 'neighborhoods'. not just individual pixels. While bright spots might catch my attention. I recognize parts of an image before it 'clicks'. So if I am using some parts of an image to inform me about the 'neighborhood' that part lives in, I am wondering if this sort of 'dynamic kernel' could produce a matrix that informs us more meaningfully about the image. Obviously I am naive and know very little about image processing but a lot of papers on image convolution get technical very fast and then I'm lost.

Yes it's true; there are image filter kernels whose coefficients may change with location of the processing and further based on image data. They're known as shift-varying filters. And data dependency also makes them nonlinear.

One prime application of shift-varying nonlinear filtering is on the edge adaptive, noise reduction where the kernel coefficients are determined based on a statistical analysis of a local group of pixels; according to whether it's an edge dominant or noise dominant block. There are different applications too.