the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > according to provide you the code, you can see the first and the second drawContours function of the second parameter is the vector type, The second argument to the third drawContours function is of type Mat. This is because drawContours function has two uses:
- is used to draw contours. The second parameter is a vector, indicating the contours to be drawn. There can be multiple contours.
- is used to fill the inside of the contour line. The second parameter is Mat, indicating the area surrounded by the contour line to be drawn. Only a single contour line can be drawn.
In your code, the first and second drawContours functions use the first usage, and the third drawContours uses the second usage. Therefore, in the third drawContours function, if the argument type is vector, there will be an error because it can only accept arguments of type Mat.
As for why only part of the points are displayed after casting hull to Mat type, it may be because hull itself is not a contour, but a vector composed of points on the contour. Therefore, casting it to Mat may only show a portion of the points.
It is recommended that you review the scenarios in your code where you use the drawContours function to make sure that the argument types are correct and that the methods you use are correct.