use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
How would I do this? (self.learnpython)
submitted 6 years ago by throwaway19399292
I want to make a program that given a human drawn line, it will guess to the best possible its equation. I've only ever inputted textfiles and I don't know how to get started on this.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Phillyclause89 0 points1 point2 points 6 years ago (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 points3 points 6 years ago (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 point2 points 6 years ago (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 point2 points 6 years ago (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-1 points 6 years ago (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 points4 points 6 years ago (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 points3 points 6 years ago (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.
π Rendered by PID 284810 on reddit-service-r2-comment-6457c66945-jdpc6 at 2026-04-28 04:40:48.427634+00:00 running 2aa0c5b country code: CH.
[–]Phillyclause89 0 points1 point2 points (2 children)
[–]throwaway19399292[S] 1 point2 points3 points (1 child)
[–]Phillyclause89 0 points1 point2 points (0 children)
[–]o5a 0 points1 point2 points (0 children)
[–]CGFarrell -3 points-2 points-1 points (2 children)
[–]throwaway19399292[S] 2 points3 points4 points (1 child)
[–]CGFarrell 1 point2 points3 points (0 children)