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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:33:17+00:00 2026-05-23T12:33:17+00:00

I have multiple images taken simultaneously pointing at the same direction from the same

  • 0

I have multiple images taken simultaneously pointing at the same direction from the same starting location. However, there is still a slight offset because these cameras were not in the exact same place when the picture was taking. I’m looking for a way to calculate the optimal translation/shear/skew/rotation needed to apply to match one image to another so that they overlay (almost) perfectly.

The images are in a .raw format which I am reading in 16 bits at a time.

I have been suggested (by my employer who is not a programmer [I’m an intern btw]) to take a portion of the source image (not at the edges) and brute-force search for a same-sized portion with a high correlation in data values. I’m hoping there is a less-wasteful algorithm.

  • 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-23T12:33:18+00:00Added an answer on May 23, 2026 at 12:33 pm

    Here is a short code that does what you want (I use openCV 2.2):

    1. Suppose you have 2 images: srcImage,dstImage, and you want to align them
    2. The code is very simple. Use it as basis for your algorithm.

    Code:

    // Detect special points on each image that can be corresponded    
    Ptr<FeatureDetector>  detector = new SurfFeatureDetector(2000);  // Detector for features
    
    vector<KeyPoint> srcFeatures;   // Detected key points on first image
    vector<KeyPoint> dstFeatures;
    detector->detect(srcImage,srcFeatures);
    detector->detect(dstImage,dstFeatures); 
    
    // Extract descriptors of the features
    SurfDescriptorExtractor extractor;  
    Mat projDescriptors, camDescriptors;
    extractor.compute(srcImage,  srcFeatures, srcDescriptors);
    extractor.compute(dstImage , dstFeatures, dstDescriptors );
    
    // Match descriptors of 2 images (find pairs of corresponding points)
    BruteForceMatcher<L2<float>> matcher;       // Use FlannBasedMatcher matcher. It is better
    vector<DMatch> matches;
    matcher.match(srcDescriptors, dstDescriptors, matches);     
    
    // Extract pairs of points
    vector<int> pairOfsrcKP(matches.size()), pairOfdstKP(matches.size());
    for( size_t i = 0; i < matches.size(); i++ ){
        pairOfsrcKP[i] = matches[i].queryIdx;
        pairOfdstKP[i] = matches[i].trainIdx;
    }
    
    vector<Point2f> sPoints; KeyPoint::convert(srcFeatures, sPoints,pairOfsrcKP);
    vector<Point2f> dPoints; KeyPoint::convert(dstFeatures, dPoints,pairOfdstKP);
    
    // Matched pairs of 2D points. Those pairs will be used to calculate homography
    Mat src2Dfeatures;
    Mat dst2Dfeatures;
    Mat(sPoints).copyTo(src2Dfeatures);
    Mat(dPoints).copyTo(dst2Dfeatures);
    
    // Calculate homography
    vector<uchar> outlierMask;
    Mat H;
    H = findHomography( src2Dfeatures, dst2Dfeatures, outlierMask, RANSAC, 3);
    
    // Show the result (only for debug)
    if (debug){
       Mat outimg;
       drawMatches(srcImage, srcFeatures,dstImage, dstFeatures, matches, outimg, Scalar::all(-1), Scalar::all(-1),
                   reinterpret_cast<const vector<char>&> (outlierMask));
       imshow("Matches: Src image (left) to dst (right)", outimg);
       cvWaitKey(0);
    }
    
    // Now you have the resulting homography. I mean that:  H(srcImage) is alligned to dstImage. Apply H using the below code
    Mat AlignedSrcImage;
    warpPerspective(srcImage,AlignedSrcImage,H,dstImage.Size(),INTER_LINEAR,BORDER_CONSTANT);
    Mat AlignedDstImageToSrc;
    warpPerspective(dstImage,AlignedDstImageToSrc,H.inv(),srcImage.Size(),INTER_LINEAR,BORDER_CONSTANT);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using AS3 to create a tween affect between multiple images that have
I have multiple projects in a couple of different workspaces. However, it seems like
I have multiple classes that all derive from a base class, now some of
I have a number of input images that contain multiple smaller images, all of
I have a form where users can enter multiple images to upload along with
I have multiple images within a div, I change thier positions using JQuery $(#+carElem).css({left:
I got a page of products which some have multiple images. I want to
I got a page of Products. Some products have multiple images (colors). I want
I have a php form where multiple images care uploaded. The file names are
I have multiple selects: <select id=one> <option value=1>one</option> <option value=2>two</option> <option value=3>three</option> </select> <select

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.