augraphy
augraphy copied to clipboard
Handwritten Annotations or Scratches
It could be useful to reproduce random scratches, artifacts or annotations created using a pen or pencil. Below are sample references for lines created using handwriting instruments.
Sample References
Added PencileScribbles augmentation (see d496cef9c9c718252ade273f7d8508bcf34e7882). With default settings it will produce something like this.
With size_range set large enough like this
PencilScribbles(size_range=(2000, 2020), p=1.0)
It can produce images like this.
With brightness_change set to 32 instead of the default 128
PencilScribbles(brightness_change=32, size_range=(2000, 2020), p=1.0)
It can create charcoal-like strokes instead of graphite-like strokes as seen belo
Looks really great @tbrettallen! 🥇
To a future dev looking at this issue, we could potentially expand this by applying this effect to lorem ipsum text that is generated using cursive fonts built in to OpenCV:
FONT_HERSHEY_SCRIPT_COMPLEX
FONT_HERSHEY_SCRIPT_SIMPLEX
Another source of handwriting text could come from the IAM Handwriting Database which includes handwriting samples from 657 writers, 1,539 pages of scanned text, 5,685 isolated and labeled sentences and 13,353 isolated and labeled text lines.
@shaheryar1 @kwcckw Would either of you be interested in adding documentation for this effect?
Also, I'm wondering if we should create notebooks for each feature. That's something we can discuss further in #33, but we could use this example as a starting point for testing out that concept. (Note that @proofconstruction has revised the documentation structure to help make it a bit more manageable.)
@shaheryar1 @kwcckw Would either of you be interested in adding documentation for this effect?
By creating documentation, do you mean adding notebook on this particular augmentation? Since right now i don't see any related page on the documentation except the one in the Readme.
Also, I'm wondering if we should create notebooks for each feature. That's something we can discuss further in #33, but we could use this example as a starting point for testing out that concept. (Note that @proofconstruction has revised the documentation structure to help make it a bit more manageable.)
I think we should create notebook with specific use case by using this augmentation? It should be a pipeline consists of this augmentation , and the other augmentations too. Otherwise, it might be not so relevant to create 1 notebook for each augmentation, some are not quite distinct on their own.
By creating documentation, do you mean adding notebook on this particular augmentation?
@kwcckw Sort of. The README was just updated with all the documentation moved around into a more organized format. Check out the new doc
folder.
… should be a pipeline consisting of this augmentation , and the other augmentations too. Otherwise, it might be not so relevant to create 1 notebook for each augmentation, some are not quite distinct on their own.
Valid point. Some augmentations won’t stand on their own. However, I think (eventually) we should strive to create notebooks documentation that is very narrowly defined so that the effect of an augmentation is center stage in the documentation of that augmentation, where possible. This pencil scribbles augmentation, for example, stands alone very well and would be obfuscated in a sample notebook that engaged other augmentations.
Perhaps a compromise is some hybrid of shared notebook samples for augmentations that go well together, which will result in fewer notebooks that we would have to maintain within the repo.
@kwcckw Sort of. The README was just updated with all the documentation moved around into a more organized format. Check out the new
doc
folder.
I see, sorry i didn't aware of that previously. Yea, i will include the documentation after i go through the code on the new agumentation.
Valid point. Some augmentations won’t stand on their own. However, I think (eventually) we should strive to create notebooks documentation that is very narrowly defined so that the effect of an augmentation is center stage in the documentation of that augmentation, where possible. This pencil scribbles augmentation, for example, stands alone very well and would be obfuscated in a sample notebook that engaged other augmentations.
Perhaps a compromise is some hybrid of shared notebook samples for augmentations that go well together, which will result in fewer notebooks that we would have to maintain within the repo.
Okay, then i think we need to create a standardize notebook format for all augmentation and create each of them first. Once we are having a clear visualization on each augmentation, then we can decide whether to merge them or not.
I was having the same confusions about making seperate notebooks for each augmentation. @kwcckw Once you write a create a standard format, do share it with me. As there are plenty of augmentations to consider , we can divide the task.
I was having the same confusions about making seperate notebooks for each augmentation. @kwcckw Once you write a create a standard format, do share it with me. As there are plenty of augmentations to consider , we can divide the task.
Right now here are the 2 main notebooks example from my end:
- https://colab.research.google.com/drive/1hLHyyvNi-cRRDOcqtPnZPCw4j25oZMDG?usp=sharing
- https://colab.research.google.com/drive/1MXNhPQ_37aiPmAOkfKNCDhKnlaPc1zDt?usp=sharing
I'm following the steps of:
- Install Augraphy
- Download sample image using gdown
- Initialize libraries
- Initialize pipeline
- Apply pipeline to image
Is this good enough or do you have any suggestion to improve the workflow in the notebook?
Added a template colab notebook, linked in #56
The pencil-oriented implementation in PencilScribbles
is well implemented (see code) which uses noise and grey color to emulate a pencil stroke.
However, we still lack the ability to produce ink-like lines in various colors, as originally intended, which would contain less noise than a pencil stroke and have more diverse range of stroke widths (e.g. thinner pen ink vs thicker markers).
We should generalize this to simply Scribbles
with stroke parameters that can be randomized.
Stroke parameters would include:
-
stroke_color
- random defaults would be typical colors such as black, grey, blue, red -
stroke_width
- default ranges typical for ink, pen or marker -
stroke_noise
- less noise would be more like a dark marker or pen, while more would be a pencil or possibly a marker) -
stroke_type
- defaults above stroke parameters to values suitable for implementing apen
,pencil
andmarker
; overrides would be honors while setting default param values where not explicitly set
This should be resolved with the update in this pull request: https://github.com/sparkfish/augraphy/pull/282