James Waldrop
James Waldrop

Reputation: 545

How do I call line or cv::line with OpenCV 3.1?

The tutorial I'm following has code like the following:

line( img_matches, ..., ..., Scalar( 0, 255, 0), 4 );

where img_matches is just a Mat, the next two arguments are points and then there's a color and a width. I have figured out everything else that changed in OpenCV 3.1 for this tutorial but I cannot figure out how to draw lines. The documentation seems to imply it will simply be cv::line(...), but that is not defined in my namespace, and there's a cvLine in scope, but it is expecting something other than a Mat it seems like.

I'm no kind of C++ programmer, so this may be something basic.

As requested, here are my headers:

#include <stdio.h>
#include <iostream>
#include "opencv2/core.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/calib3d.hpp"
#include "opencv2/xfeatures2d.hpp"

My code is 99% what's in this tutorial here: http://docs.opencv.org/3.0-beta/doc/tutorials/features2d/feature_homography/feature_homography.html

Upvotes: 1

Views: 3702

Answers (1)

slawekwin
slawekwin

Reputation: 6310

It's most likely you have not included the required header file.

Main header for opencv c++ api is in opencv.hpp, while the function you ask specifically (cv::line) is in imgproc.hpp (which is also included in most general opencv.hpp)

Upvotes: 1

Related Questions