first of all i apologize for my english. I am an electrical engineering PhD student in university of Tehran, Iran.
The way the code works is as follows:
- define sweep windows size.
- start to sweep continuously in x, y.
- if there is a window that the text_pixel/total_pixel is within the specified range this window will pass the filter and copy in new image named cleared_image.
- the original image and the cleared image will be demonstrated in vertical way.
In addition, the next idea is that if the number of black pixels on the white background of the image is greater than a limit (which we specified with the name "symbol_pixel_ratio") in this case, that window will be identified as the window containing the symbol and will be deleted.
It should be mentioned that the third idea implemented in this coding is that the input parameter called "crop_around" is defined, and when it is active, the final step in the windows of the x and y axes will always be cleared.
if there is a problem cantact me using my email address: sh.dalirian@ut.ac.ir
my linkedin profile address is : linkedin.com/in/sh-d-30174b77
Clearing windows with very low and very high pixel density
text_pixel_ratio to total pixels is defined as input parameter and has defualt value equal to 20%
symbol_pixel_ratio to total pixels is defined as input parameter and has defualt value equal to 70%
this code is generaly written for all black or white background which can de adjusted using "is_background_white" input parameter and has defualt value equal to True
here is some examples:
original image is:
cleaned image is:
if it is not continuous the output image will be:
as it can be seen the continuous cleaner is more successfull than the discrete one.
the code for discrete image cleaner is here, if you want: https://github.com/ShDalirian/windows_cleaner_image.git