Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. 2D FFT / DFT + NxN Convolution (image processing) [SOLVED] [modified]

2D FFT / DFT + NxN Convolution (image processing) [SOLVED] [modified]

Scheduled Pinned Locked Moved C#
csharpjavawinformscomgraphics
14 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dusan Paulovic
    wrote on last edited by
    #1

    EDIT: I have it solved, have found a similar library as that mine and there it is implemented in Java, so I just looked for a way to do it. It is needed to use tile-overlapping, so I modified my code and now it's working... This is that page: http://www.jhlabs.com/[^] Original message: Hi all, does anybody know some good source to learn apply a fast convolution filter to image? I am looking for kernels with 20x20 an bigger and need to process image fast, so I need to learn how to do that using FFT or DFT. I like to use GDI+ in C#. Any suggestion? Thanks in idvance...

    modified on Tuesday, August 30, 2011 4:23 AM

    S M L C 4 Replies Last reply
    0
    • D Dusan Paulovic

      EDIT: I have it solved, have found a similar library as that mine and there it is implemented in Java, so I just looked for a way to do it. It is needed to use tile-overlapping, so I modified my code and now it's working... This is that page: http://www.jhlabs.com/[^] Original message: Hi all, does anybody know some good source to learn apply a fast convolution filter to image? I am looking for kernels with 20x20 an bigger and need to process image fast, so I need to learn how to do that using FFT or DFT. I like to use GDI+ in C#. Any suggestion? Thanks in idvance...

      modified on Tuesday, August 30, 2011 4:23 AM

      S Offline
      S Offline
      share_holder
      wrote on last edited by
      #2

      Have you seen how does Matlab Function fft work? Source Code available and may be useful... Regards, D

      D 1 Reply Last reply
      0
      • D Dusan Paulovic

        EDIT: I have it solved, have found a similar library as that mine and there it is implemented in Java, so I just looked for a way to do it. It is needed to use tile-overlapping, so I modified my code and now it's working... This is that page: http://www.jhlabs.com/[^] Original message: Hi all, does anybody know some good source to learn apply a fast convolution filter to image? I am looking for kernels with 20x20 an bigger and need to process image fast, so I need to learn how to do that using FFT or DFT. I like to use GDI+ in C#. Any suggestion? Thanks in idvance...

        modified on Tuesday, August 30, 2011 4:23 AM

        M Offline
        M Offline
        MicroVirus
        wrote on last edited by
        #3

        I'm not sure here, but isn't it more typical to either convolve with a kernel in 'normal' (image) space? A convolution is rather easy to program, so I'm guessing you could readily program a fast implementation yourself. Just know that C# (and any .NET language for that matter) isn't known for its speed. If you really want the most out of your program, you could try at C++ or another machine-compiled language.

        D 1 Reply Last reply
        0
        • M MicroVirus

          I'm not sure here, but isn't it more typical to either convolve with a kernel in 'normal' (image) space? A convolution is rather easy to program, so I'm guessing you could readily program a fast implementation yourself. Just know that C# (and any .NET language for that matter) isn't known for its speed. If you really want the most out of your program, you could try at C++ or another machine-compiled language.

          D Offline
          D Offline
          Dusan Paulovic
          wrote on last edited by
          #4

          I am using native C++ to rewrite working stuff, but for testing I use C#. With GDI+ it is nice that BitmapData is same structure in .Net and native GDI+, so it is easy to migrate working code from C# to native C++. Simple convolution is what I have done already, but it is too slow (even wrote in C++) compared to PhotoShop plugins, so I am searching for FFT transform of tiles... Thanks...

          1 Reply Last reply
          0
          • S share_holder

            Have you seen how does Matlab Function fft work? Source Code available and may be useful... Regards, D

            D Offline
            D Offline
            Dusan Paulovic
            wrote on last edited by
            #5

            I have not so far, but I'll give it a try... But still, I would prefer any working example programmed in some .Net language or in native C / C++. Thanks...

            1 Reply Last reply
            0
            • D Dusan Paulovic

              EDIT: I have it solved, have found a similar library as that mine and there it is implemented in Java, so I just looked for a way to do it. It is needed to use tile-overlapping, so I modified my code and now it's working... This is that page: http://www.jhlabs.com/[^] Original message: Hi all, does anybody know some good source to learn apply a fast convolution filter to image? I am looking for kernels with 20x20 an bigger and need to process image fast, so I need to learn how to do that using FFT or DFT. I like to use GDI+ in C#. Any suggestion? Thanks in idvance...

              modified on Tuesday, August 30, 2011 4:23 AM

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Andrew Kirillov made the image procing lab which he wrote an artical on here. It is quite a good read and good library to use as well (he has other articles around it) Christian Grauss wrote a series of articales youmight find usefull. The kernal topics fall under edge detection. Image Processing for Dummies with C# and GDI+ Part 3 - Edge Detection Filters[^]

              Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

              D 1 Reply Last reply
              0
              • L Lost User

                Andrew Kirillov made the image procing lab which he wrote an artical on here. It is quite a good read and good library to use as well (he has other articles around it) Christian Grauss wrote a series of articales youmight find usefull. The kernal topics fall under edge detection. Image Processing for Dummies with C# and GDI+ Part 3 - Edge Detection Filters[^]

                Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

                D Offline
                D Offline
                Dusan Paulovic
                wrote on last edited by
                #7

                Well, Andrew Kirillov has in his library FFT filter, but in convolution filters he does not use them and I need exactly that. Also Christion has made good stuff for beginners, but my question is little more about advanced image processing than about beginner tutorial.

                L 1 Reply Last reply
                0
                • D Dusan Paulovic

                  EDIT: I have it solved, have found a similar library as that mine and there it is implemented in Java, so I just looked for a way to do it. It is needed to use tile-overlapping, so I modified my code and now it's working... This is that page: http://www.jhlabs.com/[^] Original message: Hi all, does anybody know some good source to learn apply a fast convolution filter to image? I am looking for kernels with 20x20 an bigger and need to process image fast, so I need to learn how to do that using FFT or DFT. I like to use GDI+ in C#. Any suggestion? Thanks in idvance...

                  modified on Tuesday, August 30, 2011 4:23 AM

                  C Offline
                  C Offline
                  Chris Losinger
                  wrote on last edited by
                  #8

                  if your kernels are separable, you can do the operation as a pair of 1-D convolutions (once in X, once in Y). that will change your complexity from N^2 to N.

                  image processing toolkits | batch image processing

                  D 1 Reply Last reply
                  0
                  • D Dusan Paulovic

                    Well, Andrew Kirillov has in his library FFT filter, but in convolution filters he does not use them and I need exactly that. Also Christion has made good stuff for beginners, but my question is little more about advanced image processing than about beginner tutorial.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    DusanDusan wrote:

                    Also Christion has made good stuff for beginners, but my question is little more about advanced image processing than about beginner tutorial.

                    DusanDusan wrote:

                    Hi all, does anybody know some good source to learn apply a fast convolution filter to image? I am looking for kernels with 20x20 an bigger and need to process image fast, so I need to learn how to do that using FFT or DFT.

                    Convulution filters and FFT are for the most part equivilant (different domains). Christian's articales are labeled beginner, but from your question I think it is exactly what you need. Why is it not advanced enough?? What details are you missing?

                    Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

                    D 1 Reply Last reply
                    0
                    • L Lost User

                      DusanDusan wrote:

                      Also Christion has made good stuff for beginners, but my question is little more about advanced image processing than about beginner tutorial.

                      DusanDusan wrote:

                      Hi all, does anybody know some good source to learn apply a fast convolution filter to image? I am looking for kernels with 20x20 an bigger and need to process image fast, so I need to learn how to do that using FFT or DFT.

                      Convulution filters and FFT are for the most part equivilant (different domains). Christian's articales are labeled beginner, but from your question I think it is exactly what you need. Why is it not advanced enough?? What details are you missing?

                      Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

                      D Offline
                      D Offline
                      Dusan Paulovic
                      wrote on last edited by
                      #10

                      Yes, for most part are, but exactly that part, where they are not is in my interest. What I need is to understand how to forward transform image and mask, multiply them together and transform result back to 'normal' image. I have made some algorithms, but on borders of tiles I have some errors, so I am interested in any code to look for inspiration...

                      modified on Monday, August 29, 2011 3:29 PM

                      1 Reply Last reply
                      0
                      • C Chris Losinger

                        if your kernels are separable, you can do the operation as a pair of 1-D convolutions (once in X, once in Y). that will change your complexity from N^2 to N.

                        image processing toolkits | batch image processing

                        D Offline
                        D Offline
                        Dusan Paulovic
                        wrote on last edited by
                        #11

                        Some kernels are not separable, some are separable. I would like to make it using FFT, but do not know how...

                        C 1 Reply Last reply
                        0
                        • D Dusan Paulovic

                          Some kernels are not separable, some are separable. I would like to make it using FFT, but do not know how...

                          C Offline
                          C Offline
                          Chris Losinger
                          wrote on last edited by
                          #12

                          maybe this will help: http://developer.download.nvidia.com/compute/cuda/2_2/sdk/website/projects/convolutionFFT2D/doc/convolutionFFT2D.pdf[^]

                          image processing toolkits | batch image processing

                          D 1 Reply Last reply
                          0
                          • C Chris Losinger

                            maybe this will help: http://developer.download.nvidia.com/compute/cuda/2_2/sdk/website/projects/convolutionFFT2D/doc/convolutionFFT2D.pdf[^]

                            image processing toolkits | batch image processing

                            D Offline
                            D Offline
                            Dusan Paulovic
                            wrote on last edited by
                            #13

                            This is exactly what I am looking for. I have it implemented, but there is probably any error in my coding, becouse on borders of result image I have processed pixels from opposite sides of tiles. Do you know about any code that is doing that correctly? Or is it normal? Must be used overlapping of input tiles? Thanks

                            C 1 Reply Last reply
                            0
                            • D Dusan Paulovic

                              This is exactly what I am looking for. I have it implemented, but there is probably any error in my coding, becouse on borders of result image I have processed pixels from opposite sides of tiles. Do you know about any code that is doing that correctly? Or is it normal? Must be used overlapping of input tiles? Thanks

                              C Offline
                              C Offline
                              Chris Losinger
                              wrote on last edited by
                              #14

                              sorry, i don't know of any code that does this. but, that document spends a lot of time talking about how to arrange your kernel to handle the wrap-around problem.

                              image processing toolkits | batch image processing

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups