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

  • Home
  • SEARCH
  • 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 6582419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:16:40+00:00 2026-05-25T16:16:40+00:00

I guess I am messing up something here. I am trying to perform an

  • 0

I guess I am messing up something here. I am trying to perform an FFT on an image,

Here Which is a simple image and do some padding to turn it into a 16×16 image. First the image is resized to 12×12 and then take log(img+1) amd then pad it to make it 16×16. its originally a 11×11 jpg. Checking the outputs I am sure that the padding is correct but why am I getting these huge (or very tiny on a minus) values after the FFT?

cv::dft(inputImage[0],splittedImage[0],cv::DFT_COMPLEX_OUTPUT);

Showing only the first row of real and imaginary outputs for first channel. This happens on all channels.

16 16 2
1102.98264 54.55353 -30.83002 -11.52413 0.91865 3.42735 1.56366 3.08065 4.32513 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000

0.00000 -9.31782 -29.86937 -18.65367 -8.81698 -0.44684 1.11674 -0.10631 0.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000 -6277438562204192200000000000000000000000000000000000000000000000000.00000

If I do the FFT with no DFT_XXXX options or cv::DFT_ROWS I get the following

1102.98264 54.55353 -9.31782 -30.83002 -29.86937 -11.52413 -18.65367 0.91865 -8.81698 3.42735 -0.44684 1.56366 1.11674 3.08065 -0.10631 4.32513

Am I missing a flag for cv::DFT_XX ??

Padding code

cv::Mat PadImage(cv::Mat inputImage, int padSize)
{

    cv::Mat paddedImage;
    paddedImage.create(inputImage.size().height+2*padSize, inputImage.size().width + 2*padSize, inputImage.type());

    int height = inputImage.size().height;
    int width = height;
    int paddedRow = padSize;
    int paddedCol = padSize;

    //copy original image to center of padded image
    for (int row = 0; row < height; row++)
    {
        for (int col = 0; col < width; col++)
        {
            paddedImage.at<cv::Vec3d>(row + paddedRow, col + paddedCol)[0] = inputImage.at<cv::Vec3d>(row, col)[0];
            paddedImage.at<cv::Vec3d>(row + paddedRow, col + paddedCol)[1] = inputImage.at<cv::Vec3d>(row, col)[1];
            paddedImage.at<cv::Vec3d>(row + paddedRow, col + paddedCol)[2] = inputImage.at<cv::Vec3d>(row, col)[2];
        }
    }

    // Pad top
    paddedRow -= 1;
    for (int row = 0; row < padSize; row++)
    {
        for (int col = 0; col < width; col++)
        {
            paddedImage.at<cv::Vec3d>(paddedRow, col + paddedCol)[0] = inputImage.at<cv::Vec3d>(row, col)[0];
            paddedImage.at<cv::Vec3d>(paddedRow, col + paddedCol)[1] = inputImage.at<cv::Vec3d>(row, col)[1];
            paddedImage.at<cv::Vec3d>(paddedRow, col + paddedCol)[2] = inputImage.at<cv::Vec3d>(row, col)[2];           
        }
        paddedRow--;
    }

    // Pad bottom           
    paddedRow = 2 * padSize - 1;
    for (int row = height - padSize; row < height; row++)
    {
        for (int col = 0; col < width; col++)
        {
            paddedImage.at<cv::Vec3d>(height + paddedRow, col + paddedCol)[0] = inputImage.at<cv::Vec3d>(row, col)[0];          
            paddedImage.at<cv::Vec3d>(height + paddedRow, col + paddedCol)[1] = inputImage.at<cv::Vec3d>(row, col)[1];          
            paddedImage.at<cv::Vec3d>(height + paddedRow, col + paddedCol)[2] = inputImage.at<cv::Vec3d>(row, col)[2];                      
        }
        paddedRow--;
    }

    // Pad left         
    paddedCol = padSize;
    paddedRow = padSize;
    for (int row = 0; row < height + 2 * padSize; row++)
    {

        for (int col = padSize; col <= 2*padSize; col++)
        {
            paddedImage.at<cv::Vec3d>(row, paddedCol)[0] = paddedImage.at<cv::Vec3d>(row, col)[0];                                              
            paddedImage.at<cv::Vec3d>(row, paddedCol)[1] = paddedImage.at<cv::Vec3d>(row, col)[1];                                                          
            paddedImage.at<cv::Vec3d>(row, paddedCol)[2] = paddedImage.at<cv::Vec3d>(row, col)[2];                                              
            paddedCol--;
        }
        paddedCol = padSize;
    }

    // Pad right         
    paddedCol = 2*padSize-1 + width;
    paddedRow = padSize;
    for (int row = 0; row < height + 2 * padSize; row++)
    {
        for (int col = width - padSize; col <= width+padSize; col++)
        {
            paddedImage.at<cv::Vec3d>(row, paddedCol)[0] = paddedImage.at<cv::Vec3d>(row, col)[0];                                  
            paddedImage.at<cv::Vec3d>(row, paddedCol)[1] = paddedImage.at<cv::Vec3d>(row, col)[1];                      
            paddedImage.at<cv::Vec3d>(row, paddedCol)[2] = paddedImage.at<cv::Vec3d>(row, col)[2];                      
            paddedCol--;            
        }
        paddedCol = 2*padSize-1 + width;
    }


    return paddedImage;
}
  • 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-25T16:16:40+00:00Added an answer on May 25, 2026 at 4:16 pm

    My mistake was that I had to push in a dual channel image instead of a single channel image. I was translating code by looking at matlab and mislead myself.

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

Sidebar

Related Questions

Well i guess im missing something here.. Any way im trying to make a
I guess that I am missing something here. After having found this sample within
I feel like I'm missing something here, but I have this datagrid which when
I am trying to implement a simple servlet which uses a HTTP session in
This is probably an easy one, but I'm missing something I guess. The problem
Guess that I have a TextView that I want to update it in some
Hey, im trying to wirte about 600000 Tokens into my MySQL Database Table. The
I'm trying to replace a color for something that is drawn on a Canvas
I'm trying to create a thumbnail image on the client side using javascript and
I'm trying to write a very simple number guessing game (code is below). After

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.