Banana curvature equation

The Goal

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:

  1. How to read the original image file
  2. How to convert image to black and white form
  3. How to rotate the image through 180 degrees, so that the equation will be in familiar parabolic form.
  4. Adjust the axes and shift the origin.


The second part above shows:

  1. Find the pixels of our interest as elements of the matrix
  2. Find the indices of these elements, which are the coordinates of those points
  3. Using the GNU Octave function “Polyfit” to find the coefficient matrix of the equation.
  4. 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.