[英]How to access or detect a length of object/s in openCV?
I am just new to openCV(3 days old) and currently creating a project that should assign different amounts of time for different lengths detected. 我刚接触openCV(3天大),目前正在创建一个项目,该项目应为检测到的不同长度分配不同的时间。
I was just wondering if there's a way to analyze or to run though the Y-axis of an image and then detect the presence(first binary 1 detected) and the end of an object or end of the length( last binary 1 detected after 0). 我只是想知道是否有一种方法可以分析或运行图像的Y轴,然后检测存在(检测到的第一个二进制1)和对象的末端或长度的末端(检测到0后的最后一个二进制1) )。 I am having a hard time coding such using openCV since I don't know how openCV assigns X and Y axis in the digital image. 我不容易使用openCV进行编码,因为我不知道openCV如何在数字图像中分配X和Y轴。
here is the picture binaryimage 这是图片binaryimage
Is there a way to know the area? 有没有办法知道该地区? or length of such objects? 或此类物体的长度?
To assign a pixel value for a cv::Mat
image: 为cv::Mat
图片分配像素值:
For grayscale image ( 8UC1
) 对于灰度图像( 8UC1
)
img.at<uchar>(y, x) = (uchar) value;
For Color image ( BGR
style) 对于彩色图像( BGR
样式)
img.at<Vec3b>(y, x) = Vec3b(blueValue, greenValue, redValue);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.