Convert an Image of a Table into CSV
This example demonstrates how to use image processing capabilities to convert an image of a table into a CSV file that can be easily manipulated.
In this table, horizontal and vertical grid lines are darker than the background of the cells. FindPeaks is used to find the position of these grid lines. getGridLines will return a list of two lists containing row and column grid coordinates, respectively.
The image can then be segmented based on these coordinates. TextRecognize does the heavy lifting once the image has been segmented with some minor cleanup.
This data can be exported to CSV now. When importing the CSV data, numbers are automatically interpreted, and you can build a Dataset with headers.
First, import the full data before continuing.
Now you can compare the first row of US populations to the original image.
It looks like all of the data here matches! To check if the rest of the data lines up, you can take the totals of all the columns, excluding the first row, and see if they match.
It turns out they match exactly!