Ask Your Question

Revision history [back]

Why mat.ptr<>() has the same address among all the elements inside std::vector<cv::mat>?

If I construct outfea_ in the following manner, then you'll find the three output have exactly the same value. Is it a bug in opencv?

std::vector<cv::Mat> outfea_(static_cast<unsigned long>(infea_cl), cv::Mat(pool_outfea_len_, pool_outfea_len_, CV_32FC1, cv::Scalar(0)));
cout<< outfea_.at(0).ptr<float>(0)<<endl;
cout<< outfea_.at(1).ptr<float>(0)<<endl;
cout<< outfea_.at(2).ptr<float>(0)<<endl;

Why mat.ptr<>() has the same address among all the elements inside std::vector<cv::mat>?

If I construct outfea_ in the following manner, then you'll find the three output have exactly the same value. Is it a bug in opencv?

std::vector<cv::Mat> outfea_(static_cast<unsigned long>(infea_cl), cv::Mat(pool_outfea_len_, pool_outfea_len_, outfea_(3, cv::Mat(5, 5, CV_32FC1, cv::Scalar(0)));
cout<< outfea_.at(0).ptr<float>(0)<<endl;
cout<< outfea_.at(1).ptr<float>(0)<<endl;
cout<< outfea_.at(2).ptr<float>(0)<<endl;