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
- Python Program for Check if all digits of a number divide it
- Python Program to check whether it is possible to make a divisible by 3 number using all digits in an array
- Python Program for Difference between sums of odd and even digits
- Python Program for Topological Sorting
- Python | Write multiple files data to master file
- Python | Remove all digits from a list of strings
- Python | Ways to remove numeric digits from given string
- Python | Convert list of tuples into digits
- Python | Sort list of numbers by sum of their digits
- Python | Checking if starting digits are similar in list
- Python | Remove element from given list containing specific digits
- Python | Extract digits from given string
- Python | Check possible bijection between sequence of characters and digits
- Handwritten Equation Solver in Python
- Python | Categorizing input Data in Lists
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.