How to convolve an image with different gabor filters adjusted according to the local orientation and density using FFT?

懵懂的女人 提交于 2019-11-27 22:14:01

I found a way to convolve the image with different gabor filters and gather the responses of the pixels base on their local characteristics using FFT.

This is call contextual filtering, usually when you filter an image you only apply a single kernel to the entire thing, but in contextual filtering the characteristics of the filter change according to the local context, in this case, density and orientation of the pixel.

In direct convolution the process is pretty straight forward, you simply change the kernel at each step of the convolution, but in FFT convolution since the kernel is applied to the image in the frequency domain you can't change the filter properties during the process. So the way you do it is by making the convolution of the image with each filter separately, this will give N number of filtered images where N is the numbers of filters in your filter bank, then you have to construct your final image taking information from the different filtered images based on the context of the pixel you are recreating.

So for each pixel, you look at his orientation and density properties and then grab the value of that pixel position from the filtered image that was generated by the convolving the original image with the filter with those same properties. Here is an example of the process:

This is a graphic representation of the directional map.

I used the same density for all pixels to reduce the amount of filters generated.

This is the source image:

This is an example of three of the filters used (0 degrees, 45 degrees, 90 degrees):

These are three examples of the source image being convolve with the different filters at different degrees:

And finally this is the resulting image, the image was created taking the values of the pixels from the different filtered images base on the direction and density of the pixel.

This process is A LOT slower than the direct convolution =(, since you have to convolve the original image with all the filters first. The final image took about a minute to be generated. So far I'm stuck with the direct convolution it seems =/.

Thanks for reading.

Did you try with CUDA? with the convolution and the FFT (in this case cufft) it will be faster! Try to see if there is a possibility of parallelization, actually I'm working on that and I can say that the improvement is huge. Currently I'm going to implement the Gabor filtering

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!