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 3677528
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:13:56+00:00 2026-05-19T03:13:56+00:00

I’ve been looking to the OpenCV’s magnificent source code to understand the score calculation.

  • 0

I’ve been looking to the OpenCV’s magnificent source code to understand the score calculation. As you may have noticed the library can find a template in an image with a confidence score. cvMatchTemplate function gives the probability and location of the template in image.

Since DFT is slow, I decided to use FFTW library for phase correlation. I get the image, expanded to a size which is a power of 2, then did the same to the template, first calculated the FFT for both, multiplied the two array, calculated the inverse FFT, finally normalized the result.

If I show this result on a bitmap it clearly shows the location of template, however, I have difficulties calculating the correlation score. I tried to run cvMatchTemplate method line by line under debugger, it didn’t help since the library uses DFT and arbitrary image sizes. All the tables used in that method (sum, sqsum etc) created for corresponding arbitrary sizes and FFT uses powers of two.

I would be grateful for any information on how to calculate the score from that result of phase correlation. There are many sources describing “take this, take that, multiply them, you see the white point on the image, yeah you find it” way. I need a score just like cvMatchTemplate did.

I’m kindly asking you to point me to a site or to a paper containing the logic of that calculation or to a book. Source code would be perfect but I have no hope on that anyway.

  • 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-19T03:13:57+00:00Added an answer on May 19, 2026 at 3:13 am

    First, make sure you are not “expanding the image to a power of 2”. I’m sure you didn’t mean this, but anyway with FFTW you can calculate an arbitrary size FT.

    I don’t understand what you are using OpenCV for. If you have the FFT then it is quite easy to calculate the normalised cross power spectrum by yourself, in other words the “phase correlation formula”.

    Get the largest size FFT of the images that you can, not forgetting to window. Calculate the CPS. Once you have the correlation surface look for the peak.

    I don’t know what OpenCV offers for Phase Correlation apart from FT, but the paper you want is

    G.A. Thomas, Television Motion Measurement for DATV and Other Applications, 1987, BBC Research Department.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm looking for suggestions for debugging... If you view this site in Firefox or
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put

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.