Defining the Function of a Curve in an Image with Graphical Analysis and Model Selection
CSEF · 2019 Mathematical Sciences
Overview
Objectives The main objective of this project was to create an algorithm that could take the image of a drawn curve and find a function to model it. This objective can be broken down into three smaller goals. First, obtaining a set of points from the image that represents the curve. Next, finding curves of best fit of various model types for those points. Finally, deciding which model best represents the data. Methods I used Python 3 with the Pythonista IDE and its Scene graphics package to write an iPad program that meets all three goals. I first wrote code to select all pixels of a given range of hues within an image, which then allows a user to take an image and select a curve from it based on its color. Next, I wrote separate code to find best-fit curves of various polynomial degrees and to display the best one, superimposed on the actual picture. Then, I explored various ways to select which function was the most representative using statistical analysis. Finally, I combined all the aspects of the program in a concise, user-friendly and elegant format. Results In this project, I created an efficient method to capture images and convert them to points that can be analyzed, fitting them with a range of polynomial functions. I used the Akaike Information Criterion (AIC) to choose what fit to use. However, AIC still often chooses fits that are more complicated than necessary, so I have also proposed an alternative way to choose between fits by comparing the effect of decreasing the complexity of the model. Conclusions This product could be applied as an aid in learning about how different types of functions are represented mathematically, evaluating the type of model that would best represent a predicted or observed pattern, or turning a handwritten drawing into a vectorized smooth curve. Though AIC may still be the best way to statistically choose between model fits, my proposed method poses an interesting statistical question that may merit further investigation.
Summary statement
I created a program that takes an image of a drawn curve, rasterizes it, and uses multiple methods to find the best mathematical model to describe the curve.
Help received
I wrote the program myself. My parents reviewed my presentation.
Competition history
- CSEF 2019
Resources
Related projects
CSEF · 2013
Graphical: Graphing Calculator App for the iPhone
ISEF · 2020
New Program for Construction of a Closed Curve Graph Using a Discrete Fourier Transform
CSEF · 2007
A Comparison of Numerical Integration Approximations: Midpoint, Trapezoidal, and Simpson's
CSEF · 2016
DermatoScan 2.0: Image Analysis Optimizations for the Early Detection of Skin Cancer
ISEF · 2025
Algorithmic Image Enhancement by Combining Multiple Images
CSEF · 2015
MathSuite: A Free and Innovative Android App that Makes Dreaded Calculation Fun! Published and Available on Google Play
CSEF · 2008
Morphing Circles with Trig: A Third Year Investigation
CSEF · 2006
Pick's Theorem and the A.C. Extension
Closest projects by meaning, across every fair and year in the corpus.
Browse more like this
Source: California Science & Engineering Fair public projects