Grade 3 polynomial regression in python

I have obtained the mask from the input image. How to get the line in the right figure using 3 degree polynomial regression. Can you show me some syntax? Thanks for all the help!

to perform a regression, you would need at least a few points on (or close to) that line.
what’s your plan to achieve that ?

Thank you for your help. Currently I only have the results as shown on the left. how can i find the curve like the picture on the right.

heavy blurring, followed by a threshold() will close the “holes” in your image,
then a simple thinning() might already be quite close to what you wanted:

output

1 Like

thankyou so much, it’s very helpful for me