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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:22:15+00:00 2026-06-05T14:22:15+00:00

I am attempting to learn OpenCV, and being a hard-head, I am trying to

  • 0

I am attempting to learn OpenCV, and being a hard-head, I am trying to run the following algorithm:

 cv::Mat cur_features;
 cv::goodFeaturesToTrack(current_image, cur_features, 400, 0.01, 0.01);

Now, being the hard-headed individual, I am interested to see what cur_features is holding… I expected a 400×2 cv::Mat but instead I got a 400×1 cv::Mat

No biggy, I think maybe its a direct index. However, for the LIFE of me I CANNOT extract a value from cur_features.at(0) and print it out.

What am I doing wrong? I have seen the goodFeaturesToTrack_Demo.cpp. Some things to note on that demo that differ for mine. I tried the following calls given that example:

 std::cout << cur_features.size() << std::endl; // This throws a compile time error even though its in the example
 std::cout << cur_features.at<Point2f>(0).x << std::endl; //This throws a run time error.

Could anyone direct me to some documentation that explains how to achieve my goal? The goodFeaturesToTrack tells you it returns an OutputArray which is a vector of corners, but nowhere does it describe what the type of those corners are. Where in the documentation would I look for this answer in case I get it with other methods?


Edit: Also, whats the Point of Mat::type(). I cannot find where the returned value can be explained… I’m looking for an enumeration in the documentation but having trouble finding it.

 std::cout << current_image.type() << std::endl; //This returns 0
 std::cout << cur_features.type() << std::endl; //This returns 13
  • 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-05T14:22:16+00:00Added an answer on June 5, 2026 at 2:22 pm

    As a suggestion, try to initialize matrices with dimensions and type

     cv::Mat cur_features(400,1,CV_32_FC1); //400x1 32 bits, 1 channel
     cv::Mat cur_features2(400,1,CV_32_FC2); //400x1 32 bits, 2 channels
    

    To get a value of a Mat

    int pos = 0;
    foat value = cur_features.at<float>(pos);
    cv::Vec2f value2 = cur_features2.at<Vec2f>(pos); // for a two channel, CV_23F image
    

    And a handy debug technique for Visual Studio that helped me a lot

    • 1- Right click cur_features when debugging.
    • 2- QuickWatch
    • 3- Write this:

      (float*)cur_features.data,400

    • 4- You will see all the values of the array

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

Sidebar

Related Questions

I have been attempting to learn Grails, however I am running into the following
I'm attempting to learn how to use Cucumber and creating steps using the following
I am trying to learn Qt and I am attempting to do so by
I'm trying to learn python and I'm attempting a hangman game. But when I
I'm attempting to learn Sencha Touch (and Ext JS, being more of a jquery
I'm following this tutorial , attempting to learn a bit about iPhone development, and
I am attempting to learn debugging in x86 assembly and am trying to debug
I'm attempting to learn C and already I've run into an issue. I assume
I am attempting to learn the PyMT library and am trying to implement a
I'm following this tutorial attempting to learn XNA, but I'm having issues making my

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.