Update: You can now support this project at Patreon!
Forearmed with our greyscale code we can therefore look at the Sobel mask to give us a nice crisp delimitation between the background and the text on our screen shots... Lets say we capture the top half of the market prices screen upon landing... We can capture the screen shot, convert to grey scale and then sun the sobel mask over the pixels to give a crisper showing of the text for our later OCR work...
Forearmed with our greyscale code we can therefore look at the Sobel mask to give us a nice crisp delimitation between the background and the text on our screen shots... Lets say we capture the top half of the market prices screen upon landing... We can capture the screen shot, convert to grey scale and then sun the sobel mask over the pixels to give a crisper showing of the text for our later OCR work...
There are many explanations of how Sobel Operations work, however they are very mathematical... Simply put we have each pixel (except the ones in the edge) value and for it and each neighbour we apply a mask... Lets draw some simple pictures....
Below we see the grid of pixels in our image...
Each pixel is made up of a value for Red, Green and Blue, but because the image is greyscale all three of these values are the same number, so we can just take one of them...
Next in code we need two masks, these are 3 x 3 grids of numbers, these values in the grid are applied to each pixel, except the edge pixels in our image.
So, from 1 until 1 less than the width, from 1 until 1 less than the height... Sliding the middle of the mask over the pixel target we then apply the mask to each pixel value around and including the pixel.
So we calculate and sum these values writing them into the resulting same pixel location on the end result image...
Saving the image result we see the edges of the shapes within highlighted...
No comments:
Post a Comment