c++ - How to get the pixel points of the contours? -


How do I get pixel points in contour? Suppose I have an image in which there are 5 configurations after findContours , I know that we can wipe the shape with the drawContour function, but I can use pixel points Know that the contour form

For example:

  cv :: medianBlur (img1, img1,7); Cannie (src1, img1,250,350,3); Imshow ("abc", img1); Of vector & lt; Of vector & lt; Point & gt; & Gt; Figure; FindContours (IMG1, Profile, CV_O.T.F.A.T.NL, CV_CHAN_APPRX_NON); For (int i = 0; i   

I did this and got this image, now I want to contour the pixel number, for example (x1, y1) , (X2, y2) , ... How do I get those information? here,

Contour is a 2D code dot dot . Therefore, to reach each point you can use 2 for loops (the code displays the xy co-direction of each point with the contour ID), as shown below - (Int j = 0; i & lt; contours.size; j ++) for <

    (for int i = 0; i & lt; contours.size; i ++) Cout & lt; & Lt; "Id =" & lt; & Lt; I & lt; & Lt; "(" & Lt; <> contours [i] [j] .x   

To better understand the data, you can actually reduce the number of digits in contour using the approxPolyDP check the documentation.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -