简体   繁体   中英

FFT and convolution

Im writing for school 2dFFT using on image filtering. And I have problem with filter matrix. I made my fft so it accepts 2^n input, and all filter matrix are odd numbers.

So I need solution to somehow transform filter matrix to acceptable input for my function.

I have next idea and Im not sure how it will work. If I have filter matrix:

1 2 3
4 5 6
7 8 9

To transform it to:

0 0 0 0
1 2 3 0
4 5 6 0
7 8 9 0

And when Im matching "center" of matrix with my pixel, match center of "submatrix" and after that extract values I need. Is that possible?

Also Can someone tell me what is max size of filter I can get? Is it larger than lets say 32x32?

Filter masks are used to express filters with compact support. Compact support means that the signal has non-zero values only in a limited range. By extending your filter mask with zero values, you are in fact doing a natural thing. The zeros are part of the original filter.

The real problem however is a different thing. I assume that you use FFT according to the convolution theorem . For that, you need element-wise multiplication. You can only do element-wise multiplication when both your filter and your signal have the same number of elements. So you would need to extend your filter to the signal size (using zeros).

There is no limit on filter mask size. For convolution the only restriction is compact support (as explained above).

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