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 Mathematical Sciences · Entry S1404

Resources

Related projects

Closest projects by meaning, across every fair and year in the corpus.

Browse more like this

Source: California Science & Engineering Fair public projects

Save projects to your library

Sign in with Google to keep track of projects you find interesting, organized into folders. An account also raises your daily allowance for “Has this been done?”, and lets you create a key for the MCP server with a much higher limit than anonymous use. Browsing stays public.

Continue with Google