使用 OpenCV 从线中提取点
Extracting Points from Lines using OpenCV
>我正在尝试使用C++语言中的openCV从图像上的线条中提取点。 该行被编程为显示在图像上,但我需要知道如何从线条中提取点并将其输入到文本文件中?
您可以使用
cv::LineIterator
类来获取栅格线的每个点,例如:
// grabs pixels along the line (pt1, pt2)
// from 8-bit 3-channel image to the buffer
LineIterator it(img, pt1, pt2, 8);
LineIterator it2 = it;
vector<Vec3b> buf(it.count);
for(int i = 0; i < it.count; i++, ++it)
buf[i] = *(const Vec3b)*it;
// alternative way of iterating through the line
for(int i = 0; i < it2.count; i++, ++it2)
{
Vec3b val = img.at<Vec3b>(it2.pos());
CV_Assert(buf[i] == val);
}
相关文章:
- 如何在使用OpenCV C++应用K均值后提取分割图像
- 帧提取 使用OpenCV的视频文件开头只有几秒钟
- 使用 opencv 提取最大的斑点
- 无法使用 OpenCV C++从视频中提取帧
- 从黑色背景 OpenCV C++中提取对象
- 在OpenCV中提取LBPFeatures
- 使用OpenCV从图像中提取不同尺寸的矩形
- 如何在 OpenCv 中使用 HSV 阈值和轮廓从图像中提取皮肤
- 视觉Opencv;C++;从线性三角测量法矩阵中提取点云点(x,y,z)
- OpenCV 提取的描述符会导致 valgrind 在被复制时报告无效读取
- 如何提取与OPENCV中某个函数相关的源代码
- 使用OpenCV,尝试提取由ArrayOfArrays描述的图片区域
- 如何使用 opencv c++ 从手部轮廓中提取 LBP 特征
- 如何将提取的光栅信息转换为可由opencv库处理的格式
- 如何从Opencv中的图像矩阵中提取数值梯度矩阵
- 提取一组样本图像的描述符,并在OpenCV中训练SVM
- OpenCV:从Delaunay三角剖分中提取三角形
- 基于OpenCV的背景提取
- 如何提取opencv Mat头
- 从Blob检测中提取OpenCV轮廓阵列