Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

'type' undeclared identifier opencv traits.hpp

Hi all, I've got this error in the function: "calcOpticalFlowPyrLK". Basically I have to track a book from a video given, do I used SIFT features to detect the book in the video and surrounding it with a square obtaining the following result: image description Then I have to track (and show) the features of the book using the pyramid Lukas-Kanade tracker, and I'm using the following code: for (;;) { //tracking

            vector<uchar> status;
            vector<float> err;
            vector<KeyPoint> next_keypoints;
            Mat result;
            if (prev_gray.empty())
            {
                gray.copyTo(prev_gray);
            }
            cap >> frame;
            cvtColor(frame, gray, COLOR_BGR2GRAY);
            calcOpticalFlowPyrLK(prev_gray, gray, keypoints_2, next_keypoints, status, err);
            drawKeypoints(prev_gray, keypoints_2, result);
            imshow("res", result);
            gray.copyTo(prev_gray);
            keypoints_2 = next_keypoints;

        }

Where "prev_gray" is an empty Mat defined at the beginning of the code (before of the SIFT obj detection), "gray" is the first frame of the video converted in gray scale and keypoints_2 is the vector<keypoint> of the first frame of the video.

At the execution of the method "calcOpticalFlowPyrLK(prev_gray, gray, keypoints_2, next_keypoints, status, err);", I'm getting the error "type: udeclared identifier (at traits.hpp)" and "type is not a member of 'cv::DataType<t>'"

What could be the problem? Thank y'all!

'type' undeclared identifier opencv traits.hpp

Hi all, I've got this error in the function: "calcOpticalFlowPyrLK". Basically I have to track a book from a video given, do I used SIFT features to detect the book in the video and surrounding it with a square obtaining the following result: image description Then I have to track (and show) the features of the book using the pyramid Lukas-Kanade tracker, and I'm using the following code: for (;;) { //tracking

            vector<uchar> status;
            vector<float> err;
            vector<KeyPoint> next_keypoints;
            Mat result;
            if (prev_gray.empty())
            {
                gray.copyTo(prev_gray);
            }
            cap >> frame;
            cvtColor(frame, gray, COLOR_BGR2GRAY);
            calcOpticalFlowPyrLK(prev_gray, gray, keypoints_2, next_keypoints, status, err);
            drawKeypoints(prev_gray, keypoints_2, result);
            imshow("res", result);
            gray.copyTo(prev_gray);
            keypoints_2 = next_keypoints;

        }

Where "prev_gray" is an empty Mat defined at the beginning of the code (before of the SIFT obj detection), "gray" is the first frame of the video converted in gray scale and keypoints_2 is the vector<keypoint> of the first frame of the video.

At the execution of the method "calcOpticalFlowPyrLK(prev_gray, gray, keypoints_2, next_keypoints, status, err);", I'm getting the error "type: udeclared identifier (at traits.hpp)" and "type is not a member of 'cv::DataType<t>'"

What could be the problem? Thank y'all!

'type' undeclared identifier opencv traits.hpp

Hi all, I've got this error in the function: "calcOpticalFlowPyrLK". Basically I have to track a book from a video given, do I used SIFT features to detect the book in the video and surrounding it with a square obtaining the following result: image description Then I have to track (and show) the features of the book using the pyramid Lukas-Kanade tracker, and I'm using the following code: code:

           for (;;) {
                //tracking

//tracking

            vector<uchar> status;
            vector<float> err;
            vector<KeyPoint> next_keypoints;
            Mat result;
            if (prev_gray.empty())
            {
                gray.copyTo(prev_gray);
            }
            cap >> frame;
            cvtColor(frame, gray, COLOR_BGR2GRAY);
            calcOpticalFlowPyrLK(prev_gray, gray, keypoints_2, next_keypoints, status, err);
            drawKeypoints(prev_gray, keypoints_2, result);
            imshow("res", result);
            gray.copyTo(prev_gray);
            keypoints_2 = next_keypoints;

        }

Where "prev_gray" is an empty Mat defined at the beginning of the code (before of the SIFT obj detection), "gray" is the first frame of the video converted in gray scale and keypoints_2 is the vector<keypoint> of the first frame of the video.

At the execution of the method "calcOpticalFlowPyrLK(prev_gray, gray, keypoints_2, next_keypoints, status, err);", I'm getting the error "type: udeclared identifier (at traits.hpp)" and "type is not a member of 'cv::DataType<t>'"

What could be the problem? Thank y'all!

'type' undeclared identifier opencv traits.hpp

Hi all, I've got this error in the function: "calcOpticalFlowPyrLK". Basically I have to track a book from a video given, do I used SIFT features to detect the book in the video and surrounding it with a square obtaining the following result: image description Then I have to track (and show) the features of the book using the pyramid Lukas-Kanade tracker, and I'm using the following code:

           for (;;) {
            //tracking

            vector<uchar> status;
            vector<float> err;
            vector<KeyPoint> next_keypoints;
            Mat result;
            if (prev_gray.empty())
            {
                gray.copyTo(prev_gray);
            }
            cap >> frame;
            cvtColor(frame, gray, COLOR_BGR2GRAY);
            calcOpticalFlowPyrLK(prev_gray, gray, keypoints_2, next_keypoints, status, err);
            drawKeypoints(prev_gray, keypoints_2, result);
            imshow("res", result);
            gray.copyTo(prev_gray);
            keypoints_2 = next_keypoints;

        }

Where "prev_gray" is an empty Mat defined at the beginning of the code (before of the SIFT obj detection), "gray" is the first frame of the video converted in gray scale and keypoints_2 is the vector<keypoint> of the first frame of the video.

At the execution of the method "calcOpticalFlowPyrLK(prev_gray, gray, keypoints_2, next_keypoints, status, err);", I'm getting the error "type: udeclared identifier (at traits.hpp)" and "type is not a member of 'cv::DataType<t>'"

What could be the problem? Thank y'all!

EDIT: Following break suggestion, I changed my code into:

                    vector<KeyPoint> next_keypoints1;
        vector<uchar> status;
        vector<float> err;
        vector<Point2f> next_keypoints;
        vector<Point2f> keypoints_frame_temp;
        vector<KeyPoint> keyponts_frame;
        for (;;) {
            //tracking

            KeyPoint::convert(keypoints_2, keypoints_frame_temp);
            Mat result;
            if (prev_gray.empty())
            {
                gray.copyTo(prev_gray);
            }
            cap >> frame;
            cvtColor(frame, gray, COLOR_BGR2GRAY);
            calcOpticalFlowPyrLK(prev_gray, gray, keypoints_frame_temp, next_keypoints, status, err);
            KeyPoint::convert(keypoints_frame_temp, keyponts_frame);
            drawKeypoints(prev_gray, keyponts_frame, result);
            imshow("res", result);
            gray.copyTo(prev_gray);
            KeyPoint::convert(next_keypoints, next_keypoints1);
            keyponts_frame = next_keypoints1;

        }

Using the KeyPoint::convert function to have the right type inside the calcOpticalFlowPyrLK(), but what I get in the "res" windows is just a blank space and I have no access to it (I can see the window, but I can't do anything on it). Is it a problem of my pc? Is it maybe not powerful enough for this?

'type' undeclared identifier opencv traits.hpp

Hi all, I've got this error in the function: "calcOpticalFlowPyrLK". Basically I have to track a book from a video given, do I used SIFT features to detect the book in the video and surrounding it with a square obtaining the following result: image description Then I have to track (and show) the features of the book using the pyramid Lukas-Kanade tracker, and I'm using the following code:

           for (;;) {
            //tracking

            vector<uchar> status;
            vector<float> err;
            vector<KeyPoint> next_keypoints;
            Mat result;
            if (prev_gray.empty())
            {
                gray.copyTo(prev_gray);
            }
            cap >> frame;
            cvtColor(frame, gray, COLOR_BGR2GRAY);
            calcOpticalFlowPyrLK(prev_gray, gray, keypoints_2, next_keypoints, status, err);
            drawKeypoints(prev_gray, keypoints_2, result);
            imshow("res", result);
            gray.copyTo(prev_gray);
            keypoints_2 = next_keypoints;

        }

Where "prev_gray" is an empty Mat defined at the beginning of the code (before of the SIFT obj detection), "gray" is the first frame of the video converted in gray scale and keypoints_2 is the vector<keypoint> of the first frame of the video.

At the execution of the method "calcOpticalFlowPyrLK(prev_gray, gray, keypoints_2, next_keypoints, status, err);", I'm getting the error "type: udeclared identifier (at traits.hpp)" and "type is not a member of 'cv::DataType<t>'"

What could be the problem? Thank y'all!

EDIT: Following break suggestion, I changed my code into:

                    vector<KeyPoint> next_keypoints1;
        vector<uchar> status;
        vector<float> err;
        vector<Point2f> next_keypoints;
        vector<Point2f> keypoints_frame_temp;
        vector<KeyPoint> keyponts_frame;
        for (;;) {
            //tracking

            KeyPoint::convert(keypoints_2, keypoints_frame_temp);
            Mat result;
            if (prev_gray.empty())
            {
                gray.copyTo(prev_gray);
            }
            cap >> frame;
            cvtColor(frame, gray, COLOR_BGR2GRAY);
            calcOpticalFlowPyrLK(prev_gray, gray, keypoints_frame_temp, next_keypoints, status, err);
            KeyPoint::convert(keypoints_frame_temp, keyponts_frame);
            drawKeypoints(prev_gray, keyponts_frame, result);
            imshow("res", result);
            gray.copyTo(prev_gray);
            KeyPoint::convert(next_keypoints, next_keypoints1);
            keyponts_frame = next_keypoints1;

        }

Using the KeyPoint::convert function to have the right type inside the calcOpticalFlowPyrLK(), but what I get in the "res" windows is just a blank space and I have no access to it (I can see the window, but I can't do anything on it). Is it a problem of my pc? Is it maybe not powerful enough for this?