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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:05:39+00:00 2026-05-31T12:05:39+00:00

I use this to functions as a base of my tracking algorithm. //1. detect

  • 0

I use this to functions as a base of my tracking algorithm.

    //1. detect the features
    cv::goodFeaturesToTrack(gray_prev, // the image 
    features,   // the output detected features
    max_count,  // the maximum number of features 
    qlevel,     // quality level
    minDist);   // min distance between two features

    // 2. track features
    cv::calcOpticalFlowPyrLK(
    gray_prev, gray, // 2 consecutive images
    points_prev, // input point positions in first im
    points_cur, // output point positions in the 2nd
    status,    // tracking success
    err);      // tracking error

cv::calcOpticalFlowPyrLK takes vector of points from the previous image as input, and returns appropriate points on the next image. Suppose I have random pixel (x, y) on the previous image, how can I calculate position of this pixel on the next image using OpenCV optical flow function?

  • 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-31T12:05:40+00:00Added an answer on May 31, 2026 at 12:05 pm

    As you write, cv::goodFeaturesToTrack takes an image as input and produces a vector of points which it deems “good to track”. These are chosen based on their ability to stand out from their surroundings, and are based on Harris corners in the image. A tracker would normally be initialised by passing the first image to goodFeaturesToTrack and obtaining a set of features to track. These features could then be passed to cv::calcOpticalFlowPyrLK as the previous points, along with the next image in the sequence and it will produce the next points as output, which then become input points in the next iteration.

    If you want to try to track a different set of pixels (rather than features generated by cv::goodFeaturesToTrack or a similar function), then simply provide these to cv::calcOpticalFlowPyrLK along with the next image.

    Very simply, in code:

    // Obtain first image and set up two feature vectors
    cv::Mat image_prev, image_next;
    std::vector<cv::Point> features_prev, features_next;
    
    image_next = getImage();
    
    // Obtain initial set of features
    cv::goodFeaturesToTrack(image_next, // the image 
      features_next,   // the output detected features
      max_count,  // the maximum number of features 
      qlevel,     // quality level
      minDist     // min distance between two features
    );
    
    // Tracker is initialised and initial features are stored in features_next
    // Now iterate through rest of images
    for(;;)
    {
        image_prev = image_next.clone();
        feature_prev = features_next;
        image_next = getImage();  // Get next image
    
        // Find position of feature in new image
        cv::calcOpticalFlowPyrLK(
          image_prev, image_next, // 2 consecutive images
          points_prev, // input point positions in first im
          points_next, // output point positions in the 2nd
          status,    // tracking success
          err      // tracking error
        );
    
        if ( stopTracking() ) break;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use min(5,10) , or Math.max(4,7) . Are there functions to this
I often use convenience functions that return pointers to static buffers like this: char*
Im not sure that it is the right way but I use this functions
I'm trying to use the Base 64 functions present in the Apache Commons Codec
I use this function to find any installed application . But the parameter InstallLocation
I use this function substr(tbarticles.articlebody,1,200) as description1 in a query but for some articles
I currently use this function to wrap executing commands and logging their execution, and
I am trying to use this function from a COM API which enables the
I want to use this function EnumWindows(EnumWindowsProc, NULL);. The EnumWindowsProc is a Callback function:
I want to use this function: http://www.frankmacdonald.co.uk/php/post-to-wordpress-with-php.html Its used to post to Wordpress using

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.