本文整理汇总了C++中Conversion::rgb2hsv方法的典型用法代码示例。如果您正苦于以下问题:C++ Conversion::rgb2hsv方法的具体用法?C++ Conversion::rgb2hsv怎么用?C++ Conversion::rgb2hsv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conversion
的用法示例。
在下文中一共展示了Conversion::rgb2hsv方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: colour_extracted
cv::Mat ExtractColour::pcd2colourHSV(pcl::PointCloud<pcl::PointXYZRGBA> cloud)
{
cv::Mat colour_extracted(cloud.height*cloud.width, 3, CV_32F);
pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr cloudPtr (new pcl::PointCloud<pcl::PointXYZRGBA> (cloud));
Conversion conversion;
#pragma omp parallel
{
#pragma omp for shared (colour_extracted, cloud) private (i, j) reduction(+: sum)
{
for(int i=0; i<cloudPtr->width; i++)
for(int j = 0; j <cloudPtr->height; j++)
{
std::vector<double> hsv=conversion.rgb2hsv(cloudPtr->points[i].r,cloudPtr->points[i].g,cloudPtr->points[i].b); // perform RGB to HSV conversion
colour_extracted.at<float>(i + j*cloudPtr->width, 1) = hsv[0]; // save H parameter
colour_extracted.at<float>(i + j*cloudPtr->width, 2) = hsv[1]; // save S parameter
colour_extracted.at<float>(i + j*cloudPtr->width, 3) = hsv[2]; // save V parameter
}
}
}
return colour_extracted;
}
示例2: colours
std::vector<Matrix_double> ExtractColour::indexPCD2VectorHSV(pcl::PointCloud<pcl::PointXYZRGBA> cloud, std::vector<int> index)
{
std::vector <Matrix_double> colours(3);
pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr cloudPtr (new pcl::PointCloud<pcl::PointXYZRGBA> (cloud));
Conversion conversion;
#pragma omp parallel
{
#pragma omp for shared (index, cloud, colours) private (i) reduction(+: sum)
{
for (int i=0; i<index.size(); i++)
{
std::vector<double> hsv=conversion.rgb2hsv(cloudPtr->points[index[i]].r,cloudPtr->points[index[i]].g,cloudPtr->points[index[i]].b); // perform RGB to HSV conversion
colours[i].columns.push_back(hsv[0]); // save H parameter
colours[i].columns.push_back(hsv[1]); // save S parameter
colours[i].columns.push_back(hsv[2]); // save V parameter
}
}
}
return colours;
}