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 For example: I did this and got this image, now I want to contour the pixel number, for example Contour is a 2D code To better understand the data, you can actually reduce the number of digits in contour using the findContours , I know that we can wipe the shape with the
drawContour function, but I can use pixel points Know that the contour form
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
(x1, y1) ,
(X2, y2) ,
... How do I get those information? ,
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
approxPolyDP check the documentation.
Comments
Post a Comment