Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Sep 4, 2022
1 parent e901443 commit 79a2f47
Show file tree
Hide file tree
Showing 7 changed files with 561 additions and 55 deletions.
21 changes: 19 additions & 2 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
- **Additional Properties** _(object)_
- **`scanimage_arguments`** _(array)_: Additional scanimage arguments.
- **Items** _(string)_
- **`auto_bash`** _(boolean)_: Run the ADF in tow step odd and even, needed for scanner that don't support double face. Default: `False`.
- **`auto_bash`** _(boolean)_: Run the ADF in tow space odd and even, needed for scanner that don't support double face. Default: `False`.
- **`rotate_even`** _(boolean)_: Rotate the even pages, to use in conjunction with auto_bash. Default: `False`.

## Definitions
Expand Down Expand Up @@ -89,7 +89,7 @@
- **`deskew`** _(object)_: The deskew configuration.
- **`min_angle`** _(number)_: The minimum angle to detect the image skew [degree]. Default: `-45`.
- **`max_angle`** _(number)_: The maximum angle to detect the image skew [degree]. Default: `45`.
- **`angle_derivation`** _(number)_: The step of angle to detect the image skew [degree]. Default: `0.1`.
- **`angle_derivation`** _(number)_: The space of angle to detect the image skew [degree]. Default: `0.1`.
- **`sigma`** _(number)_: Used in the `canny` function. Default: `3.0`.
- **`num_peaks`** _(integer)_: number of peaks we ask for. Default: `20`.
- **`angle_pm_90`** _(boolean)_: Detect an angle of +/- 90 degree, also +/- 45 degree. Default: `False`.
Expand All @@ -101,3 +101,20 @@
- **`threshold`** _(integer)_: The threshold used in the Hough transform. Default: `100`.
- **`min_line_length`** _(integer)_: The minimum line length in percentage of the image size used in the Hough transform. Default: `50`.
- **`max_line_gap`** _(integer)_: The maximum line gap in percentage of the image size used in the Hough transform. Default: `100`.
- **`rule`** _(object)_: Configuration of rule displayed in assisted split images.
- **`enable`** _(boolean)_: Default: `True`.
- **`minor_graduation_step`** _(integer)_: Default: `10`.
- **`major_graduation_step`** _(integer)_: Default: `100`.
- **`lines_step`** _(integer)_: Default: `100`.
- **`minor_graduation_size`** _(integer)_: Default: `10`.
- **`major_graduation_size`** _(integer)_: Default: `30`.
- **`graduation_color`** _(array)_: Default: `[0, 0, 0]`.
- **Items** _(integer)_
- **`line_color`** _(array)_: Default: `[0, 0, 0]`.
- **Items** _(integer)_
- **`lines_opacity`** _(number)_: Default: `0.2`.
- **`graduation_text_font_filename`** _(string)_: Default: `/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf`.
- **`graduation_text_font_size`** _(number)_: Default: `17`.
- **`graduation_text_font_color`** _(array)_: Default: `[0, 0, 0]`.
- **Items** _(integer)_
- **`graduation_text_margin`** _(integer)_: Default: `6`.
19 changes: 18 additions & 1 deletion process.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
- **`deskew`** _(object)_: The deskew configuration.
- **`min_angle`** _(number)_: The minimum angle to detect the image skew [degree]. Default: `-45`.
- **`max_angle`** _(number)_: The maximum angle to detect the image skew [degree]. Default: `45`.
- **`angle_derivation`** _(number)_: The step of angle to detect the image skew [degree]. Default: `0.1`.
- **`angle_derivation`** _(number)_: The space of angle to detect the image skew [degree]. Default: `0.1`.
- **`sigma`** _(number)_: Used in the `canny` function. Default: `3.0`.
- **`num_peaks`** _(integer)_: number of peaks we ask for. Default: `20`.
- **`angle_pm_90`** _(boolean)_: Detect an angle of +/- 90 degree, also +/- 45 degree. Default: `False`.
Expand All @@ -115,3 +115,20 @@
- **`threshold`** _(integer)_: The threshold used in the Hough transform. Default: `100`.
- **`min_line_length`** _(integer)_: The minimum line length in percentage of the image size used in the Hough transform. Default: `50`.
- **`max_line_gap`** _(integer)_: The maximum line gap in percentage of the image size used in the Hough transform. Default: `100`.
- **`rule`** _(object)_: Configuration of rule displayed in assisted split images.
- **`enable`** _(boolean)_: Default: `True`.
- **`minor_graduation_step`** _(integer)_: Default: `10`.
- **`major_graduation_step`** _(integer)_: Default: `100`.
- **`lines_step`** _(integer)_: Default: `100`.
- **`minor_graduation_size`** _(integer)_: Default: `10`.
- **`major_graduation_size`** _(integer)_: Default: `30`.
- **`graduation_color`** _(array)_: Default: `[0, 0, 0]`.
- **Items** _(integer)_
- **`line_color`** _(array)_: Default: `[0, 0, 0]`.
- **Items** _(integer)_
- **`lines_opacity`** _(number)_: Default: `0.2`.
- **`graduation_text_font_filename`** _(string)_: Default: `/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf`.
- **`graduation_text_font_size`** _(number)_: Default: `17`.
- **`graduation_text_font_color`** _(array)_: Default: `[0, 0, 0]`.
- **Items** _(integer)_
- **`graduation_text_margin`** _(integer)_: Default: `6`.
131 changes: 129 additions & 2 deletions scan_to_paperless/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@
# WARNING: The required are not correctly taken in account,
# See: https:/camptocamp/jsonschema-gentypes/issues/6
"line_detection": "LineDetection",
# WARNING: The required are not correctly taken in account,
# See: https:/camptocamp/jsonschema-gentypes/issues/6
"rule": "Rule",
},
total=False,
)
Expand Down Expand Up @@ -716,7 +719,7 @@
"scanimage_arguments": List[str],
# Auto bash
#
# Run the ADF in tow step odd and even, needed for scanner that don't support double face
# Run the ADF in tow space odd and even, needed for scanner that don't support double face
#
# default: False
"auto_bash": bool,
Expand Down Expand Up @@ -747,6 +750,58 @@
ROTATE_EVEN_DEFAULT = False


# Default value of the field path 'Rule enable'
RULE_ENABLE_DEFAULT = True


# Default value of the field path 'Rule graduation_color'
RULE_GRADUATION_COLOR_DEFAULT = [0, 0, 0]


# Default value of the field path 'Rule graduation_text_font_color'
RULE_GRADUATION_TEXT_FONT_COLOR_DEFAULT = [0, 0, 0]


# Default value of the field path 'Rule graduation_text_font_filename'
RULE_GRADUATION_TEXT_FONT_FILENAME_DEFAULT = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"


# Default value of the field path 'Rule graduation_text_font_size'
RULE_GRADUATION_TEXT_FONT_SIZE_DEFAULT = 17


# Default value of the field path 'Rule graduation_text_margin'
RULE_GRADUATION_TEXT_MARGIN_DEFAULT = 6


# Default value of the field path 'Rule line_color'
RULE_LINES_COLOR_DEFAULT = [0, 0, 0]


# Default value of the field path 'Rule lines_opacity'
RULE_LINES_OPACITY_DEFAULT = 0.2


# Default value of the field path 'Rule lines_step'
RULE_LINES_SPACE_DEFAULT = 100


# Default value of the field path 'Rule major_graduation_size'
RULE_MAJOR_GRADUATION_SIZE_DEFAULT = 30


# Default value of the field path 'Rule major_graduation_step'
RULE_MAJOR_GRADUATION_SPACE_DEFAULT = 100


# Default value of the field path 'Rule minor_graduation_size'
RULE_MINOR_GRADUATION_SIZE_DEFAULT = 10


# Default value of the field path 'Rule minor_graduation_step'
RULE_MINOR_GRADUATION_SPACE_DEFAULT = 10


# Default value of the field path 'Arguments run_exiftool'
RUN_EXIFTOOL_DEFAULT = False

Expand All @@ -763,6 +818,78 @@
RUN_PS2PDF_DEFAULT = False


# Rule
#
# Configuration of rule displayed in assisted split images
Rule = TypedDict(
"Rule",
{
# Rule enable
#
# default: True
"enable": bool,
# Rule minor graduation space
#
# default: 10
"minor_graduation_step": int,
# Rule major graduation space
#
# default: 100
"major_graduation_step": int,
# Rule lines space
#
# default: 100
"lines_step": int,
# Rule minor graduation size
#
# default: 10
"minor_graduation_size": int,
# Rule major graduation size
#
# default: 30
"major_graduation_size": int,
# Rule graduation color
#
# default:
# - 0
# - 0
# - 0
"graduation_color": List[int],
# Rule lines color
#
# default:
# - 0
# - 0
# - 0
"line_color": List[int],
# Rule lines opacity
#
# default: 0.2
"lines_opacity": Union[int, float],
# Rule graduation text font filename
#
# default: /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
"graduation_text_font_filename": str,
# Rule graduation text font size
#
# default: 17
"graduation_text_font_size": Union[int, float],
# Rule graduation text font color
#
# default:
# - 0
# - 0
# - 0
"graduation_text_font_color": List[int],
# Rule graduation text margin
#
# default: 6
"graduation_text_margin": int,
},
total=False,
)


# Default value of the field path 'Configuration scanimage_arguments'
SCANIMAGE_ARGUMENTS_DEFAULT = ["--format=png", "--mode=color", "--resolution=300"]

Expand Down Expand Up @@ -837,7 +964,7 @@
"max_angle": Union[int, float],
# Deskew angle derivation
#
# The step of angle to detect the image skew [degree]
# The space of angle to detect the image skew [degree]
#
# default: 0.1
"angle_derivation": Union[int, float],
Expand Down
85 changes: 83 additions & 2 deletions scan_to_paperless/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
"angle_derivation": {
"type": "number",
"default": 0.1,
"description": "The step of angle to detect the image skew [degree]",
"description": "The space of angle to detect the image skew [degree]",
"title": "Deskew angle derivation"
},
"sigma": {
Expand Down Expand Up @@ -424,6 +424,87 @@
"title": "Line detection max line gap"
}
}
},
"rule": {
"type": "object",
"title": "Rule",
"description": "Configuration of rule displayed in assisted split images",
"properties": {
"enable": {
"title": "Rule enable",
"type": "boolean",
"default": true
},
"minor_graduation_step": {
"title": "Rule minor graduation space",
"type": "integer",
"default": 10
},
"major_graduation_step": {
"title": "Rule major graduation space",
"type": "integer",
"default": 100
},
"lines_step": {
"title": "Rule lines space",
"type": "integer",
"default": 100
},
"minor_graduation_size": {
"title": "Rule minor graduation size",
"type": "integer",
"default": 10
},
"major_graduation_size": {
"title": "Rule major graduation size",
"type": "integer",
"default": 30
},
"graduation_color": {
"title": "Rule graduation color",
"type": "array",
"default": [0, 0, 0],
"items": {
"type": "integer"
}
},
"lines_color": {
"title": "Rule lines color",
"type": "array",
"default": [0, 0, 0],
"items": {
"type": "integer"
}
},
"lines_opacity": {
"title": "Rule lines opacity",
"type": "number",
"default": 0.2
},
"graduation_text_font_filename": {
"title": "Rule graduation text font filename",
"type": "string",
"default": "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
},
"graduation_text_font_size": {
"title": "Rule graduation text font size",
"type": "number",
"default": 17
},
"graduation_text_font_color": {
"title": "Rule graduation text font color",
"type": "array",
"default": [0, 0, 0],
"items": {
"type": "integer"
}
},
"graduation_text_margin": {
"title": "Rule graduation text margin",
"type": "integer",
"default": 6
}
}
}
}
}
Expand Down Expand Up @@ -543,7 +624,7 @@
},
"auto_bash": {
"type": "boolean",
"description": "Run the ADF in tow step odd and even, needed for scanner that don't support double face",
"description": "Run the ADF in tow space odd and even, needed for scanner that don't support double face",
"title": "Auto bash",
"default": false
},
Expand Down
Loading

0 comments on commit 79a2f47

Please sign in to comment.