Whites out the background pretty well. Changed it
to an adaptive threshold first and then use contours to get a mask.
Also using morphology to clean up said mask.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Just adding a little bit of complexity to try and remove some of the
random clumps and spots that appear.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
The mask used for inpainting wasn't correct (it seems).
Updated it to use the correct mask for inpainting.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Using just OTSU thresholding with some morphology as it's similar
quality but a lot faster.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
As the title says but also adjusted the demoing and specle
thresholding functions so that they work a bit better.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Instead of bluring the edge, now I used inpainting
to use the page colour to fill in the background so it's uniform.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Whites out the background pretty well. Changed it
to an adaptive threshold first and then use contours to get a mask.
Also using morphology to clean up said mask.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Currently have Rectangle library set up; just need to implement
the actual functions in the .cpp file. Also set Line library to
begin creating the class and functions. Set up the CMake as well
which was a bit of a pain. Also added the libraries branch to
the setup scripts.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Isolates and returns grayscale images of each line at original
resolution. (which is much less since it's a small selected
part of the original image).
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Clustering but need to deskew before subclustering.
Looking to dewarp page now (done in the autocropper branch).
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Moving around the testing notebooks. Autocropping is about done
with exception to any new versions or converting the stuff to C
code.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Title. Plan is to just convert all the houghline
processing into C since it should be faster than the python opencv.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
As title says, cleaning up and putting the used/important
functions into myfunctions.py file so they could be easily used.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Final version of V2 of houghline preprocessing.
May need to make changes to this version but it's complete
and ready for the OCR and actual ML part now.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
I believe the idea is to use morphology to clean
up the merged threshold version and then get bounding boxes
for the letters, get a mask from those bounding boxes and
and then apply the merged thresh onto a white page using the mask.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Still struggling with getting the text set well while
removing all the other noise and such.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Now to implement cleaning up the resulting image so that
the the outer area and page is white and the text is black.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Houghline crop now returns a cropped version of
the original image (no threshold/black-and-white or
a shrunken picture (smaller size). Just the base image cropped
to what it should be. Need to now add post processing
to make the background white and sharpen the image (make the text
a hard black and the page a hard white).
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Currently breaking it down in to more digestable
functions and then need to work on post processing so
that the main piece is kept and the background is set to
white and the main piece of paper is set to completely white
with text being full black.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
Now have deskewing and cropping as one function.
Need to modify it still so it refines the photo even more
and also returns just the rotated rectangle of the original image
instead of the effected (by morphology) image.
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>