本文整理汇总了C++中cv::Ptr::setInt方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::setInt方法的具体用法?C++ Ptr::setInt怎么用?C++ Ptr::setInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cv::Ptr
的用法示例。
在下文中一共展示了Ptr::setInt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mask
void reduce_measurement_g2o::compute_features(const cv::Mat & rgb,
const cv::Mat & depth, const Eigen::Vector3f & intrinsics,
cv::Ptr<cv::FeatureDetector> & fd,
cv::Ptr<cv::DescriptorExtractor> & de,
std::vector<cv::KeyPoint> & filtered_keypoints,
pcl::PointCloud<pcl::PointXYZ> & keypoints3d, cv::Mat & descriptors) {
cv::Mat gray;
if (rgb.channels() != 1) {
cv::cvtColor(rgb, gray, cv::COLOR_BGR2GRAY);
} else {
gray = rgb;
}
cv::GaussianBlur(gray, gray, cv::Size(3, 3), 3);
int threshold = 400;
fd->setInt("hessianThreshold", threshold);
//int threshold = 100;
//fd->setInt("thres", threshold);
std::vector<cv::KeyPoint> keypoints;
cv::Mat mask(depth.size(), CV_8UC1);
depth.convertTo(mask, CV_8U);
fd->detect(gray, keypoints, mask);
for (int i = 0; i < 5; i++) {
if (keypoints.size() < 300) {
threshold = threshold / 2;
fd->setInt("hessianThreshold", threshold);
//fd->setInt("thres", threshold);
keypoints.clear();
fd->detect(gray, keypoints, mask);
} else {
break;
}
}
if (keypoints.size() > 400)
keypoints.resize(400);
filtered_keypoints.clear();
keypoints3d.clear();
for (size_t i = 0; i < keypoints.size(); i++) {
if (depth.at<unsigned short>(keypoints[i].pt) != 0) {
filtered_keypoints.push_back(keypoints[i]);
pcl::PointXYZ p;
p.z = depth.at<unsigned short>(keypoints[i].pt) / 1000.0f;
p.x = (keypoints[i].pt.x - intrinsics[1]) * p.z / intrinsics[0];
p.y = (keypoints[i].pt.y - intrinsics[2]) * p.z / intrinsics[0];
//ROS_INFO("Point %f %f %f from %f %f ", p.x, p.y, p.z, keypoints[i].pt.x, keypoints[i].pt.y);
keypoints3d.push_back(p);
}
}
de->compute(gray, filtered_keypoints, descriptors);
}