Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3316772
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:30:32+00:00 2026-05-17T22:30:32+00:00

I want to implement some image-processing algorithms which are intended to run on a

  • 0

I want to implement some image-processing algorithms which are intended to run on a beagleboard. These algorithms use convolutions extensively. I’m trying to find a good C implementation for 2D convolution (probably using the Fast Fourier Transform). I also want the algorithm to be able to run on the beagleboard’s DSP, because I’ve heard that the DSP is optimized for these kinds of operations (with its multiply-accumulate instruction).

I have no background in the field so I think it won’t be a good idea to implement the convolution myself (I probably won’t do it as good as someone who understands all the math behind it). I believe a good C convolution implementation for DSP exists somewhere but I wasn’t able find it?

Could someone help?

EDIT: Turns out the kernel is pretty small. Its dimensions are either 2X2 or 3X3. So I guess I’m not looking for an FFT-based implementation. I was searching for convolution on the web to see its definition so I can implement it in a straight forward way (I don’t really know what convolution is). All I’ve found is something with multiplied integrals and I have no idea how to do it with matrices. Could somebody give me a piece of code (or pseudo code) for the 2X2 kernel case?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:30:32+00:00Added an answer on May 17, 2026 at 10:30 pm

    What are the dimensions of the image and the kernel ? If the kernel is large then you can use FFT-based convolution, otherwise for small kernels just use direct convolution.

    The DSP might not be the best way to do this though – just because it has a MAC instruction doesn’t mean that it will be more efficient. Does the ARM CPU on the Beagle Board have NEON SIMD ? If so then that might be the way to go (and more fun too).

    For a small kernel, you can do direct convolution like this:

    // in, out are m x n images (integer data)
    // K is the kernel size (KxK) - currently needs to be an odd number, e.g. 3
    // coeffs[K][K] is a 2D array of integer coefficients
    // scale is a scaling factor to normalise the filter gain
    
    for (i = K / 2; i < m - K / 2; ++i) // iterate through image
    {
      for (j = K / 2; j < n - K / 2; ++j)
      {
        int sum = 0; // sum will be the sum of input data * coeff terms
    
        for (ii = - K / 2; ii <= K / 2; ++ii) // iterate over kernel
        {
          for (jj = - K / 2; jj <= K / 2; ++jj)
          {
            int data = in[i + ii][j +jj];
            int coeff = coeffs[ii + K / 2][jj + K / 2];
    
            sum += data * coeff;
          }
        }
        out[i][j] = sum / scale; // scale sum of convolution products and store in output
      }
    }
    

    You can modify this to support even values of K – it just takes a little care with the upper/lower limits on the two inner loops.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i want to upload the image to HTTP server, image upload is working
I wonder how could I implement an asynchronous call in standard C++. I have
I have a fairly image-intensive iPhone app, and I'm looking to store remotely downloaded
Can some CSS expert help guide me to achieve slant line in a box
I have to implement gtalk like chat application using UDP in java. i have
I am loading images from a database and want to dynamically resize them according
Right now when I set an image over a button and make it border-less
(This is a post that I'm moving from ui stackexchange. ) We have some
i am using Imagemagick for converting my .pdf file to .png images but when
I have an application that receives a pointer to JPEG data from a camera

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.