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

The Archive Base Latest Questions

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

I’m trying to calculate the (cross?) correlation between a template image (an image which

  • 0

I’m trying to calculate the (cross?) correlation between a template image (an image which is part of a bigger image), to the image which the template belongs to.

Suppose the template image is 3×2 and the large image is 20×20. What i did first is grayscaled both images. Then i got the mean of the gray values (again for both). After that i checked pixel by pixel if the current pixel is lower or higher than the mean. If it’s lower then i colored the pixel black, if it’s higher then the pixel will be white. So basically this leaves me with a binary image. Where 1==white and 0==black.

My template image binary value is: 101010

Then in the large image i start scanning each pixel to see if it matches the template. So i start at x=0, y=0 in the big image and i compare the first three pixel on the X axis from the first two rows on the Y axis with the ones of the template image. The binary value for that is: 111010

So the next step is to check the correlation, right? Now here’s the tricky part for me because i’m not sure if i’m doing it right. But this is what i’ve come up with:

101010 (template image)

Sum = 3

Mean = 0.5

Standard Deviation = 4,2

111010 (big image, first section)

Sum = 4

Mean = 0,66

Standard Deviation = 2,82

Then i tried to calculate the correlation like so:

enter image description here

Which got me the following result:
r = -0,04

Since this number isn’t close to 1 at all, this means there is no close correlation right?
Or maybe i have to compare it to n-2 = the critical value. So in this case, 6-2 = 4. Since it isn’t close to 4 either this also means that there is no correlation, right?

And what does it mean when it’s close to -1, does this mean that there is even less correlation?

And most important, are my calculation correct..? Or am i still missing something..??

  • 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-26T16:05:16+00:00Added an answer on May 26, 2026 at 4:05 pm

    I’ve had another look at your question. I think you’re confusing cross-correlation with convolution.

    Basically, you use cross-correlation when you have two images of the same size, and you want to tell how similar you are. For example, you could use it on two subsequent frames in a video. Cross-correlation yields a single number.

    You’d use convolution when you have a template image of a small size and you want to find its location in an image of a larger size (for this reason, it’s also commonly known as template matching). Convolution yields a new image. Each pixel (x, y) in this new image represents the strength of the match of the template to the original image location (x, y). Typically, after performing convolution, you look for the maximum value (or values) in the convolution result, and use that as the detected locations of the template.

    Given the way you’ve worded your question, it sounds like convolution is indeed what you are after. In your cases, the images are of different sizes, so you can’t really calculate cross-correlation meaningfully.

    Finally, after you’ve figured out how it all works, you should comfort yourself in the thought that most image processing libraries handle include this functionality. Everyone who’s done any decent image processing has implemented convolution at least once just for the fun of it, though 🙂

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
Specifically, suppose I start with the string string =hello \'i am \' me And
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

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.