Can I use contour points smooth by using points interpolation in opencv?

I got a contour by using the findcontour function.
Current contour line so strange.
I want smooth line by using interpolation to the contour. Can I do it? I am using c++


please show the findcontours / drawing code.

is it just a drawing problem, like you want anti-aliasing here ?

vector<vector<Point>> contours_left,contours_left_dp, contours_right;
vector<Vec4i> hierarchy1,hierarchy2;
findContours( test, contours_left, hierarchy1, RETR_TREE, CHAIN_APPROX_NONE );

vector<vector<Point>> hull(contours_left.size());

//Make a vector for new line
vector<Point> new_hull;
for(int i=0; i<hull[0].size()-1; i++)

//Make a new line
 vector<vector<Point>> contours_left_new;
Mat new_hull_img = Mat::zeros(transM.rows, transM.cols, CV_8UC1);
cv::polylines(new_hull_img, new_hull, false, Scalar(255,255,255), 1);

This is source code. above output result is “new_hull_img”

yes, I want anti-aliasing

polylines will accept the same LINE_AA flag you used before in drawContours()

1 Like

Thank you so much your reply