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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:34:46+00:00 2026-06-17T13:34:46+00:00

I am trying to use OpenCV for Android (OpenCV 2.4.3) I am writing a

  • 0

I am trying to use OpenCV for Android (OpenCV 2.4.3)
I am writing a program to track keypoints. I am trying to use FeatureDetector to detect keypoints and then Video.calcOpticalFlowPyrLK
to track them.
The question that has me stumped is that the FeatureDetector function returns a MatOfKeyPoint while calcOpticalFlowPyrLK takes a MatOfPoint2f.

Note that MatOfKeyPoint is different from MatOfPoint (Conversion from MatOfPoint to MatOfPont2f is straightforward).

Here is my code so far:

//Feature detector for LKT flow estimation
FeatureDetector cvFeatureDetector;
//Vector of keypoints
MatOfKeyPoint keypoints;

...
...

//intitialize detector
cvFeatureDetector = FeatureDetector.create(FeatureDetector.GFTT);

keypoints = new MatOfKeyPoint();

...
...

//mPrevImgMat is a grayscale image - previous frame
//mCurrentImgMat is a grayscale image - current frame

//Run feature detector in previous image
cvFeatureDetector.detect(mPrevImgMat, keypoints);

MatOfPoint2f keypointsFound = new MatOfPoint2f();
MatOfByte keypointsStatus = new MatOfByte();
MatOfFloat err = new MatOfFloat();
Size winSize = new Size(25,25);
int maxLevel = 3;

//Optical flow to find keypoints in current image
Video.calcOpticalFlowPyrLK(mPrevImgMat, mCurrentImgMat, keypoints,
            keypointsFound, keypointsStatus, err, winSize, maxLevel);

//Obviously "keypoints" in the line above does not work. How does one covert
//keypoints to MatOfPoint2f?

Things I have tried unsuccessfully so far:
(1) keypoints.convertTo()
(2) Creating a vector from keypoints and then trying to populate a vector of Point Vector pointList. Then typecast to MatOfPoint2f when calling flow funciton
(MatOfPoint2f) pointList
(3) Trying to populate a MatOfPoint2f from scratch. Cant figure out how to do this
(4) Using fromArray method in MatOfPoint2f – Not sure what this method does. Documentation is blank for this method. Am I missing something obvious?

  • 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-06-17T13:34:47+00:00Added an answer on June 17, 2026 at 1:34 pm

    Answering my own question… I got the answer in another forum. The link to that discussion is below
    http://www.answers.opencv.org/question/6206/opencv4android-conversion-from-matofkeypoint-to/

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

Sidebar

Related Questions

I'm trying to use android-opencv 2.3.1 to recognize circles (coins) in an image. However
I'm trying to use a medianBlur in my first OpenCV application on Android. It's
I'm trying to use new OpenCV feature on Android: native camera access. According to
i'm trying to use stereouncalibratedrectify from opencv for android and i didn't find the
I am trying to use OpenCV and Python to stitch together several hundred puzzle
I'm trying to use OpenCV 2.0 to take three points, which essentially make up
I'm trying to use the new OpenCV 2.0 API in MS Visual C++ 2008
I'm really stuck trying to use java wrapper library for opencv's cvMatchTemplate. See this
I'm new to OpenCV and would like to use its Python binding. When trying
I'm trying to use the imwrite() OpenCV function. I want to save the frames

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.