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 );
cv::drawContours(img,contours_left,0,Scalar(0,0,255),2,LINE_AA,hierarchy1);
//cv::imshow("contours_left",contours_left);
vector<vector<Point>> hull(contours_left.size());
convexHull(contours_left[0],hull[0],false);
//Make a vector for new line
vector<Point> new_hull;
for(int i=0; i<hull[0].size()-1; i++)
{
new_hull.push_back(hull[0][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);
cv::imshow("new_hull_lines",new_hull_img);
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