Add lineart transformation.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2017-07-03 14:05:03 -04:00
parent 77bcc41903
commit 6bad5e02d1
3 changed files with 22 additions and 0 deletions

View File

@@ -2,6 +2,9 @@
===============
- Add view to download a document's OCR text. GitLab #215
- Add user configurable mailer. GitLab #286.
- Use Toasts library for screen messages.
- Reduce verbosity of some debug messages.
- Add new lineart transformation.
2.4 (2017-06-23)
================

View File

@@ -24,6 +24,10 @@ Other Changes
- Make the task manager translatable.
- Add Turkish to the list of processes languages.
- Add user configurable mailer support. GitLab issue #286.
- Use Toastr libary for screen messages.
- Reduce verbosity of some debug messages.
- New lineart transformation. Useful to increase the OCR accuracy on some kind
of documents.
Removals
--------

View File

@@ -324,6 +324,16 @@ class TransformationGaussianBlur(BaseTransformation):
return self.image.filter(ImageFilter.GaussianBlur(radius=self.radius))
class TransformationLineArt(BaseTransformation):
label = _('Line art')
name = 'lineart'
def execute_on(self, *args, **kwargs):
super(TransformationLineArt, self).execute_on(*args, **kwargs)
return self.image.convert('L').point(lambda x: 0 if x < 128 else 255, '1')
class TransformationMirror(BaseTransformation):
arguments = ()
label = _('Mirror')
@@ -452,6 +462,7 @@ class TransformationZoom(BaseTransformation):
BaseTransformation.register(TransformationCrop)
BaseTransformation.register(TransformationFlip)
BaseTransformation.register(TransformationGaussianBlur)
BaseTransformation.register(TransformationLineArt)
BaseTransformation.register(TransformationMirror)
BaseTransformation.register(TransformationResize)
BaseTransformation.register(TransformationRotate)
@@ -460,3 +471,7 @@ BaseTransformation.register(TransformationRotate180)
BaseTransformation.register(TransformationRotate270)
BaseTransformation.register(TransformationUnsharpMask)
BaseTransformation.register(TransformationZoom)