本文整理汇总了C++中cv::vector::end方法的典型用法代码示例。如果您正苦于以下问题:C++ vector::end方法的具体用法?C++ vector::end怎么用?C++ vector::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cv::vector
的用法示例。
在下文中一共展示了vector::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: labelPockets
cv::vector<pocket> PointLocator::infer(cv::vector<cv::KeyPoint> orangeKeyPoints, cv::vector<cv::KeyPoint> greenKeyPoints,
cv::vector<cv::KeyPoint> purpleKeyPoints, cv::vector<cv::KeyPoint> pinkKeyPoints)
{
//Define vector of pocket points to be passed
cv::vector<pocket> pockets;
//There should be a maximum of 2 points per colour. If there is more, reduce.
//This depends on the quality of test video results.
//Right now it just takes the first 2 points in vector to prevent crashes.
//Takes only one point for orange and purple since they are side pockets
//TODO if needed later.
if (orangeKeyPoints.size() > 1){
orangeKeyPoints.erase(orangeKeyPoints.begin() + 1, orangeKeyPoints.end());
}
if (greenKeyPoints.size() > 2){
greenKeyPoints.erase(greenKeyPoints.begin() + 2, greenKeyPoints.end());
}
if (purpleKeyPoints.size() > 1){
purpleKeyPoints.erase(purpleKeyPoints.begin() + 1, purpleKeyPoints.end());
}
if (pinkKeyPoints.size() > 3){
pinkKeyPoints.erase(pinkKeyPoints.begin() + 3, pinkKeyPoints.end());
}
//Returns a vector of pocket type
pockets = labelPockets(orangeKeyPoints, greenKeyPoints, purpleKeyPoints, pinkKeyPoints);
return pockets;
}
示例2: removeOutlier
void RemoveNoise::removeOutlier(cv::vector<cv::Point2f>& start,
cv::vector<cv::Point2f>& end) const
{
float averageNorm = 0.0f;
for(auto startIter=start.begin(),endIter=end.begin();
startIter!=start.end(); startIter++,endIter++)
{
averageNorm += cv::norm(*startIter - *endIter);
}
averageNorm /= start.size();
for(auto startIter=start.begin(), endIter=end.begin();
startIter!=start.end(); /* look at the end of for */)
{
if(cv::norm(*startIter - *endIter) > threshNorm * averageNorm){
startIter = start.erase(startIter);
endIter = end.erase(endIter);
continue;
}
startIter++, endIter++;
}
}
示例3: cutFeatures
bool VisualFeatureExtraction::cutFeatures(cv::vector<cv::KeyPoint> &kpts,
cv::Mat &features, unsigned short maxFeats) const {
// store hash values in a map
std::map<size_t, unsigned int> keyp_hashes;
cv::vector<cv::KeyPoint>::iterator itKeyp;
cv::Mat sorted_features;
unsigned int iLine = 0;
for (itKeyp = kpts.begin(); itKeyp < kpts.end(); itKeyp++, iLine++)
keyp_hashes[(*itKeyp).hash()] = iLine;
// sort values according to the response
std::sort(kpts.begin(), kpts.end(), greater_than_response());
// create a new descriptor matrix with the sorted keypoints
sorted_features.create(0, features.cols, features.type());
sorted_features.reserve(features.rows);
for (itKeyp = kpts.begin(); itKeyp < kpts.end(); itKeyp++)
sorted_features.push_back(features.row(keyp_hashes[(*itKeyp).hash()]));
features = sorted_features.clone();
// select the first maxFeats features
if (kpts.size() > maxFeats) {
vector<KeyPoint> cutKpts(kpts.begin(), kpts.begin() + maxFeats);
kpts = cutKpts;
features = features.rowRange(0, maxFeats).clone();
}
return 0;
}
示例4: isEnoughHalfVector
bool RemoveNoise::isEnoughHalfVector(cv::vector<cv::Point2f>& start) const
{
int xCenter = frameSize.width / 2;
int count = 0;
for(auto startIter=start.begin(); startIter!=start.end(); startIter++){
if((left? startIter->x <= xCenter: xCenter < startIter->x)){
count++;
}
}
if(count < threshNum / 2) return false;
return true;
}