The project is about the applications of matlab GUI on the image processing. It is important to process the image and get the each point on the figure. Here are some technics which will have some help with that to get more accurate values.
The biggest problem is that how to find or track the line you want and withdraw the points on that line. For example, there is a figure:
In this figure, the line we want is in blue. But, there are some words or black lines which will influence reading points. In this case, it is vital to cut the figure which we need and wipe out the grid.
First, cut the figure by using ginput function to find the original points and end of x-aix and y-aix:
Then, cut the figure by these three points and get :
By this figure, only curve and grid left, next step is to clean the grid. We find that the color of line and grid is different. One is deep and another is light. So, change the figure to binary will fix it:
Now, we can read the each point by finding the 0 in every pixels and store it into an array.
However, there are some cases that the grid is not easily cleared by binary image.
case 1: when there are some single points in the figure.
some colors of grids are not different to much with curve especially at cross points. Here is a example:
after processing:
It is clear show that some single points are left on the figure. In this case, we will need the a function to clean it. The method is to find each point equal to 0 and check whether the area around it is all 0. If yes, this point will be 1 which is white.
Then, the single points is cleared.
case 2: grids line is in the same color with curve
In this case, it is hard to distinguish with curve we want. See the figure below:
As usual, cut the figure firstly.
Though the figure is in black and white, it is also a gray image. We need to change it to binary image.
Now, the chart is in binary. However, it is hard to divide grid and curve. We use a function to check the each row and column that whether the numbers of 0 in row and column is take place more than 10% of whole pixels on that line. This is the result.
By this function, the grid will be cleared.