Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
841 views
in Technique[技术] by (71.8m points)

c++ - openCV 3.0.0 cv::vector missing

I'm upgrading from opencv 2.4.11 to 3.0.0 I have used cv::vector in my code <br> but now I get the error vector in not a member of 'cv'

I will start using std::vector instead <br> however I can't find anywhere was it removed or just moved to another header file?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In OpenCV prior to 3.0, you can see at the beginning of core.hpp that OpenCV is using std::vector internally:

#ifndef __OPENCV_CORE_HPP__
#define __OPENCV_CORE_HPP__

...
#include <vector>
...

/*! 
amespace cv
    Namespace where all the C++ OpenCV functionality resides
*/
namespace cv {
...
using std::vector;
...

So you can access std::vector also through cv namespace like:

cv::vector

In fact, internally OpenCV refers to std::vector just as vector.

In OpenCV 3.0 instead the #using std::vector is not present, and internally OpenCV refers always to std::vector.

You'll be able to use cv::vector adding this into your code:

namespace cv
{
    using std::vector;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...