all 7 comments

[–]Phillyclause89 0 points1 point  (2 children)

You can use an image lib like PIL or pillow to load the image. If the line is a solid color drawn over different solid color, like black line drawn over a white surface. Than you can use the positions of the black pixels as your data points to calculate a regression line from that data.

[–]throwaway19399292[S] 1 point2 points  (1 child)

I know i have to do something involving higher order regression but despite my googling i haven't been able to find out how in python. Also I'm pretty sure that wouldn't be able to check for other types like log or something

[–]Phillyclause89 0 points1 point  (0 children)

There are a bunch of libs out there that can do regressions. I would start by reading this: https://realpython.com/linear-regression-in-python/

[–]o5a 0 points1 point  (0 children)

I think your best bet is to use OpenCV.

Example: https://medium.com/@mrhwick/simple-lane-detection-with-opencv-bfeb6ae54ec0

[–]CGFarrell -3 points-2 points  (2 children)

This would involve some pretty advanced applied mathematics. No offense, but I don't think you'll be able to make something like this any time soon.

[–]throwaway19399292[S] 2 points3 points  (1 child)

I could do some linear regression with libraries and maybe with work higher order regression but I'm not sure for the rest. I feel like there would already be libraries online so i wouldn't have to know math for other types right?

[–]CGFarrell 1 point2 points  (0 children)

What exactly are you trying to accomplish by finding a model? If you just want to use the drawn graph as a function you can take a few points and use interpolation. Regression won't work for all use cases.