Document Image Augmentation is simple to use tool for performing Augmentation on Document-based Images.
This tool provides a total of 4 types of document Augmentation
- Add support for Ground Truth
- Add Flip and Rotate
- Add Another Document Specific Augmentation
- Modify Color Changer to automatically detect background color
pip install numpy
pip install opencv-python
- Process a single image:
python DocAug.py --input_image_filename ../images/image1.jpg
- Process all images in a directory :
python DocAug.py --input_image_dir ../images/ --out_dir ../results/
NOTE : Dialation and Smudge distort the text on the doc, and is useful for object detection task, Do not use this for OCR or text related task
- Dialation
AugImage = DocumentAugmention.Dialate(BGRImage)
- Smudge
AugImage = DocumentAugmention.Smudge(BGRImage)
- Color Changer
Color changer will pick random color from 6 distint color and change it with the white background
AugImage = DocumentAugmention.changeColor(image)
- Brightness Up and Down
Increase the Brightness.
AugImage = DocumentAugmention.BrightnessUp(BGRImage)
AugImage = DocumentAugmention.BrightnessUp(BGRImage,alpha=50.0)
Decrease the Brightness.
AugImage = DocumentAugmention.BrightnessDown(BGRImage)
AugImage = DocumentAugmention.BrightnessDown(BGRImage,alpha=50.0)
Ayan Gadpal : ayangadpal2 [at] gmail [dot] com
Know more about Dialation and smudge in Here