简体   繁体   中英

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.

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). 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.

here is the picture binaryimage

Is there a way to know the area? or length of such objects?

To assign a pixel value for a cv::Mat image:

  • For grayscale image ( 8UC1 )

     img.at<uchar>(y, x) = (uchar) value; 
  • For Color image ( BGR style)

     img.at<Vec3b>(y, x) = Vec3b(blueValue, greenValue, redValue); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM