Hand-Written Digits using Topological Data Analysis
Given a hand-written digit picture, we need to convert it into graph plots using point clouds.
Examples: Given a handwritten digit. We have to convert it into graph
There are some steps to follow to convert the given image to plots.
- Binarise the image using thresholding techniques.
- Apply component labelling of the image.
- Using TDA Mapper, convert the image into point cloud and plot.
Binarisation: Binarisation means to convert the pixel image to binary image. More simply, it is to convert the image to an pixel array, that will just contain 0 and 1.
Link to download the input image: Input Image
We have converted our image to binary and it looks like this-
Figure: Binary image
Link: Binary Image
Component Labelling: Using component labelling we can label the picture separately along with its components. For example, we can differentiate between the holes of digit 8 and background. Here is the code for component labelling along with example.
Here is the output image:
Figure: Component Labelled Image
Link: Component Labelled Image
As you can see, the background, the hole of 6 is differentiated by different colour.
Using TDA Mapper: The Mapper algorithm is a method for topological data analysis. It has large applications, a small part being, plotting maps. This package comes with Scikit-TDA of python. For installation of TDA-Mapper in PC, refer this-http://danifold.net/mapper/installation/index.html.
After installation, if we run MapperGUI.py, we will get a python application and we can input the component labelled image. After this, we will get the output image as-
Link: Graph Plotted Image