I’ve done that too. In essence it kinda sorta comes down to a small convolution kernel with learned weights.
In some places it works really well.