To study machine learning, I decided to find the equation of banana curvature. The following photograph is processed further to find the equation of the banana curve.
The GNU Octave script
Following two images show the script.
The first part above shows:
- How to read the original image file
- How to convert image to black and white form
- How to rotate the image through 180 degrees, so that the equation will be in familiar parabolic form.
- Adjust the axes and shift the origin.
The second part above shows:
- Find the pixels of our interest as elements of the matrix
- Find the indices of these elements, which are the coordinates of those points
- Using the GNU Octave function “Polyfit” to find the coefficient matrix of the equation.
- Validate the equation by plotting its graph and comparing it with the original (rotated) (black and white)image of the banana. See the image below.
You can download the script banana here.