Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

DSO missing from command line!!

hi guys below is my code and errors too, please help me,, i have included all the required libraries still this weired error i am facing..

#include <iostream>
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>
//#include <opencv2/video.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/calib3d.hpp>





using namespace cv;
using namespace std;
using namespace cv::xfeatures2d;

/** @function main */
int main( int argc, char** argv )
{


     VideoCapture cap(0);
     //Mat curr, prev;
     if(!cap.isOpened())return -1;
     Mat frame;
    Mat prevframe;

    while (cap.isOpened()) {
        cap.read(frame);


        // more code goes here which I haven't written here

        frame.copyTo(prevframe); // set previous frame to current frame
        //imshow("Video current", frame);
       // imshow("Videoprevious", frame);

        char key = waitKey(33);
        if (key == 'q')
        {
            break;
        }
  //-- Step 1: Detect the keypoints using SURF Detector
  int minHessian = 400;
  Ptr<SURF> detector = SURF::create( minHessian );
  detector->setHessianThreshold(minHessian);
  std::vector<KeyPoint> keypoints_1, keypoints_2;
  Mat descriptors_1, descriptors_2;
  detector->detectAndCompute( frame, Mat(), keypoints_1, descriptors_1 );
  detector->detectAndCompute( prevframe, Mat(), keypoints_2, descriptors_2 );
  //-- Step 2: Matching descriptor vectors using FLANN matcher
  FlannBasedMatcher matcher;
  std::vector< DMatch > matches;
  matcher.match( descriptors_1, descriptors_2, matches );
  double max_dist = 0; double min_dist = 100;
  //-- Quick calculation of max and min distances between keypoints
  for( int i = 0; i < descriptors_1.rows; i++ )
  { double dist = matches[i].distance;
    if( dist < min_dist ) min_dist = dist;
    if( dist > max_dist ) max_dist = dist;
  }
  //-- Draw only "good" matches (i.e. whose distance is less than 2*min_dist,
  //-- or a small arbitary value ( 0.02 ) in the event that min_dist is very
  //-- small)
  //-- PS.- radiusMatch can also be used here.
  std::vector< DMatch > good_matches;
  for( int i = 0; i < descriptors_1.rows; i++ )
  { if( matches[i].distance <= max(2*min_dist, 0.02) )
    { good_matches.push_back( matches[i]); }
  }
  //-- Draw only "good" matches
  Mat img_matches;
  drawMatches( frame, keypoints_1, prevframe, keypoints_2,
               good_matches, img_matches, Scalar::all(-1), Scalar::all(-1),
               vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );
  //-- Show detected matches
  imshow( "Good Matches", img_matches );
    }
  waitKey(0);
  return 0;
}

and the error is as follows :

Building target: surfdetection Invoking: Cross G++ Linker g++ -L/usr/local/lib -o "surfdetection" ./detection.o -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_features2d -lopencv_xfeatures2d -lopencv_calib3d /usr/bin/ld: ./detection.o: undefined reference to symbol '_ZN2cv5flann17KDTreeIndexParamsC1Ei' //usr/local/lib/libopencv_flann.so.3.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status makefile:44: recipe for target 'surfdetection' failed make: * [surfdetection] Error 1

17:11:58 Build Finished (took 1s.519ms)

DSO missing from command line!!

hi guys below is my code and errors too, please help me,, i have included all the required libraries still this weired error i am facing..

please help

thanks

#include <iostream>
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>
//#include <opencv2/video.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/calib3d.hpp>





using namespace cv;
using namespace std;
using namespace cv::xfeatures2d;

/** @function main */
int main( int argc, char** argv )
{


     VideoCapture cap(0);
     //Mat curr, prev;
     if(!cap.isOpened())return -1;
     Mat frame;
    Mat prevframe;

    while (cap.isOpened()) {
        cap.read(frame);


        // more code goes here which I haven't written here

        frame.copyTo(prevframe); // set previous frame to current frame
        //imshow("Video current", frame);
       // imshow("Videoprevious", frame);

        char key = waitKey(33);
        if (key == 'q')
        {
            break;
        }
  //-- Step 1: Detect the keypoints using SURF Detector
  int minHessian = 400;
  Ptr<SURF> detector = SURF::create( minHessian );
  detector->setHessianThreshold(minHessian);
  std::vector<KeyPoint> keypoints_1, keypoints_2;
  Mat descriptors_1, descriptors_2;
  detector->detectAndCompute( frame, Mat(), keypoints_1, descriptors_1 );
  detector->detectAndCompute( prevframe, Mat(), keypoints_2, descriptors_2 );
  //-- Step 2: Matching descriptor vectors using FLANN matcher
  FlannBasedMatcher matcher;
  std::vector< DMatch > matches;
  matcher.match( descriptors_1, descriptors_2, matches );
  double max_dist = 0; double min_dist = 100;
  //-- Quick calculation of max and min distances between keypoints
  for( int i = 0; i < descriptors_1.rows; i++ )
  { double dist = matches[i].distance;
    if( dist < min_dist ) min_dist = dist;
    if( dist > max_dist ) max_dist = dist;
  }
  //-- Draw only "good" matches (i.e. whose distance is less than 2*min_dist,
  //-- or a small arbitary value ( 0.02 ) in the event that min_dist is very
  //-- small)
  //-- PS.- radiusMatch can also be used here.
  std::vector< DMatch > good_matches;
  for( int i = 0; i < descriptors_1.rows; i++ )
  { if( matches[i].distance <= max(2*min_dist, 0.02) )
    { good_matches.push_back( matches[i]); }
  }
  //-- Draw only "good" matches
  Mat img_matches;
  drawMatches( frame, keypoints_1, prevframe, keypoints_2,
               good_matches, img_matches, Scalar::all(-1), Scalar::all(-1),
               vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );
  //-- Show detected matches
  imshow( "Good Matches", img_matches );
    }
  waitKey(0);
  return 0;
}

and the error is as follows :

Building target: surfdetection Invoking: Cross G++ Linker g++ -L/usr/local/lib -o "surfdetection" ./detection.o -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_features2d -lopencv_xfeatures2d -lopencv_calib3d /usr/bin/ld: ./detection.o: undefined reference to symbol '_ZN2cv5flann17KDTreeIndexParamsC1Ei' //usr/local/lib/libopencv_flann.so.3.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status makefile:44: recipe for target 'surfdetection' failed make: * [surfdetection] Error 1

17:11:58 Build Finished (took 1s.519ms)