Skip to content

Commit f99f305

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 6b80008 + 4d2b3a5 commit f99f305

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Assignment4/codes/main.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,16 @@ void bezier(const std::vector<cv::Point2f> &control_points, cv::Mat &window)
5959
for (double t = 0.0; t <= 1.0; t += 0.001)
6060
{
6161
auto point = recursive_bezier(control_points, t);
62-
63-
window.at<cv::Vec3b>(point.y, point.x)[1] = 255;
62+
for(int i=-1;i<=1;i++){
63+
for(int j=-1;j<=1;j++){
64+
cv::Point2f t;
65+
t.x=point.x+i;
66+
t.y=point.y+j;
67+
float d=sqrt(pow(t.x-((int)t.x+i)-0.5,2)+pow(t.y-((int)t.y+j)-0.5,2));
68+
float ratio=1.0-sqrt(2)/3.0*d;
69+
window.at<cv::Vec3b>(t.y, t.x)[1] = std::fmax(255*ratio,window.at<cv::Vec3b>(t.y, t.x)[1]);
70+
}
71+
}
6472
}
6573

6674
}

0 commit comments

Comments
 (0)