openCV fincontours for float
openCV fincontours for float
这是我的代码,正如你所看到的,我正在使用cv::Point和Vec4i
cv::Mat bwImage;
cv::cvtColor(dst,bwImage, CV_RGB2GRAY);
cv::vector<cv::vector<cv::Point> > contours1;
cv::vector<cv::Vec4i> hierarchy2;
//% Get the borders of each object
//[B,~] = bwboundaries(bwImgLabeled,'noholes');
cv::findContours(bwImage,contours1,hierarchy2,CV_RETR_CCOMP, CV_CHAIN_APPROX_NONE);
既然我需要精度,有没有办法将其用于cv::Point2f?所以findContours()不会返回x=4,y=3,但会返回x=4.312…,y=3.145。。。。?
输入是整数数据(图像),因此输出也是整数数据(这是最精确的答案)。在您的情况下,我建议您从提供不同的标志来查找Contours开始。尝试使用CV_CHAIN_APPROX_TC89_L1而不是CV_CHAIN _APPROX_NONE。这将执行一些多边形简化,即它将稍微"平滑"轮廓以换取精度。或者,您可以在调用findContours后使用approxPolyDP来执行简化。
相关文章:
- "error: no matching function for call to"构造函数错误
- 表示"accepting anything for this template argument" C++概念的通配符
- 如何在C++中从两个单独的for循环中添加两个数组
- 在Linux for Windows上编译C++代码时出错
- 调用专用模板时出错"no matching function for call to [...]"
- 为什么我的for循环不能正确获取argv
- 为什么我不能在 FOR LOOP 中使用 i/10,C++?
- Arduino:for/while/if在void setup()或void loop()之前?——错误:之前需要不合格
- 在基于范围的for循环中使用结构化绑定声明
- 通过for循环使用用户输入填充列表
- 使用for循环检查数组中的重复项
- 在for循环中使用auto vs decltype(vec.size())来处理字符串的向量
- 为什么 const std::p air<K,V>& 在 std::map 上基于范围的 for 循环不起作用?
- 正在使用for循环创建QScatterSerie
- Python中的for循环与C++有何不同
- std::memory_order for std::atomic:<T>:wait
- openCV fincontours for float
- Cast boost::array<float, 12> for function with argument(const float (&arr)[12])
- 混淆C++ 翻译:float&,两个 for 循环
- 解析 char 到 vector<float> for hog.setSVMdetector(vector<float>)