augraphy
augraphy copied to clipboard
Question with augmentationpipeline.py
In augmentationpipeline.py
line 99 and 100, why we are converting ink image to gray by default? This is causing all ink phase input image is in grayscale form, is this necessary and any reason to do so?
That’s a great question. @tbrettallen might know the history, but I suspect it was a hack for some reason at the time it was written. And that reason may no longer be applicable. Presumably we could just remove that and see what happens when we run various tests. If something breaks, then we can make an appropriate accommodation.
Yea, i think it's better to remove it, since we might need colour information in ink phase too, and all augmentations should be made to compatible with single channel or multiple channels' image.
@kwcckw Can you remove this and do some testing to make sure it doesn't introduce bugs? I think it should be fine, but we should check anyway.
We probably also need to change other augmentations to not convert to grayscale, and then we can do the grayscale conversion right before the call to print_ink_to_paper
.
@kwcckw Can you remove this and do some testing to make sure it doesn't introduce bugs? I think it should be fine, but we should check anyway.
Yea, i will remove that and check again, actually right now i'm still testing on the pipeline and there's quite a number of bugs when we combine more than 1 augmentations into the pipeline.
We probably also need to change other augmentations to not convert to grayscale, and then we can do the grayscale conversion right before the call to
print_ink_to_paper
.
I think all of the augmentations should be having a section of code to check whether input is grayscale or colour, and then apply the augmentation accordingly. For print_ink_to_paper
, it should be working for colour image right? Else we would need to edit the code so that it can overlay colour image too.
The Ink Layer was originally developed as an "Ink Mask". The values 0-255 determine the "intensity" of the Ink and the color of the ink is selected at some point in the code and applied. This choice was made due to the complexity of supporting multi-colored ink layers and the fact all the documents we were using were black and white.
There would probably be a number of issues that need to be corrected if this is changed. I'm not sure how to off the top of my head as this was a difficult problem to solve.