0
$\begingroup$

Suppose, I have this kernel.

-1, -1, -1,
-1,  9, -1,
-1, -1, -1

(1) Can this kernel be used in an FFT-based convolution?

But,

(2) What could be the reason of my failure?

$\endgroup$

closed as unclear what you're asking by Marcus Müller, Peter K. Aug 25 '16 at 12:26

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ The bounty doesn't change that it's not quite clear what you're asking. $\endgroup$ – Jazzmaniac Aug 23 '16 at 19:54
  • $\begingroup$ this is now a pretty different question than it originally was $\endgroup$ – Marcus Müller Aug 24 '16 at 10:57
  • $\begingroup$ @MarcusMüller, I had nothing left to do. $\endgroup$ – user18425 Aug 24 '16 at 11:26
0
+50
$\begingroup$

To answer your question:

  1. Can easily be done.
    One must remember that the short signal (The Kernel) must be padded (With zeros) to have the same size as the image before the DFT conversion.
    Once they have the same size all needed is to convert into the Frequency Domain have element by element multiplication and transform back.
    A side note would be that this way you assume periodic boundary condition.
  2. I'm not a C# / C Coder.
    I can provide you a MATLAB reference if needed.
    Just make sure you do the following steps:

    • Pad the kernel to the image size (Pad it with zeros to the right and left).
    • Convert into the Frequency Domain.
    • Multiply Element by element.
    • Convert back to the spatial domain.

Just notice that in cases of large image you better (Efficiency wise) apply it in the spatial domain.

Enjoy...

$\endgroup$
  • $\begingroup$ "Just make sure you do the following steps: ... ... ... " --- Actually, I am following the same steps, but, for some reason it's not working. $\endgroup$ – user18425 Aug 24 '16 at 6:28
  • $\begingroup$ Would it help if I added MATLAB Code? Thank You. $\endgroup$ – Royi Aug 25 '16 at 7:42