Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Generalize template alignment(SIFT + delaunay trinagulation) + Contrast preprocessor + coverage module #197

Merged
merged 28 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d6f4660
fix: wip template alignment
Udayraj123 May 5, 2024
a128175
feat: add Contrast preprocessor
Udayraj123 May 5, 2024
8077dd2
fix: rename areaTemplate to areaPreset
Udayraj123 May 5, 2024
347c18d
fix: wip
Udayraj123 May 5, 2024
09ea665
fix: rename area to zone
Udayraj123 Jul 12, 2024
683aa92
fix: new sample
Udayraj123 Jul 12, 2024
8c1f3e2
fix: conflicts;
Udayraj123 Jul 12, 2024
56d0f59
feat: template alignment using SIFT
Udayraj123 Jul 12, 2024
95ca4a4
feat: add phase_correlation_shifts
Udayraj123 Jul 14, 2024
d81cbe7
fix: wip sift issues
Udayraj123 Jul 20, 2024
87f089d
fix: bugs with triangles
Udayraj123 Jul 20, 2024
b345515
fix: visualize triangle warps
Udayraj123 Jul 20, 2024
562fa18
fix: sift matching issue
Udayraj123 Jul 20, 2024
450d1a0
feat: implement k_nearest_interpolation; refactor;
Udayraj123 Jul 21, 2024
b0c5247
fix: wip streak marking
Udayraj123 Jul 27, 2024
a25dc01
feat: working streak marking support
Udayraj123 Jul 27, 2024
5557daa
fix: issues during testing
Udayraj123 Jul 28, 2024
916039f
fix: minor fixes
Udayraj123 Jul 29, 2024
04b7a16
feat: support for output_mode==moderation
Udayraj123 Jul 30, 2024
406843d
feat: wip local scripts
Udayraj123 Aug 1, 2024
9eba5ab
fix: moderation mode issues
Udayraj123 Aug 1, 2024
f97d562
fix: wip handle non-utf paths in ascii chars in filenames
Udayraj123 Aug 1, 2024
c02fb88
fixed utf character issue in windows
palash018 Aug 1, 2024
eb5a601
fix: wip
Udayraj123 Aug 1, 2024
92243ff
feat: add coverage module
Udayraj123 Aug 3, 2024
4f86a9d
fix: wip
Udayraj123 Aug 4, 2024
6e86cee
fix: wip
Udayraj123 Aug 4, 2024
d1169ef
fix: unrecognized arguments: -i
Udayraj123 Sep 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ outputs/*
venv/
OMRChecker.wiki/
pytestdebug.log
.coverage
70 changes: 38 additions & 32 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
exclude: "(__snapshots__|__image_snapshots__)/.*$"
default_install_hook_types: [pre-commit, pre-push]
repos:
# Convert the pngs to jpgs inside samples folder
- repo: local
hooks:
- id: convert-images
name: Convert png to jpg in samples
entry: scripts/hooks/convert_images_hook.py
args: ["--trigger-size", "150"]
files: ^samples.*\.(png|PNG)$
pass_filenames: true
stages: [commit]
language: python
language_version: python3
additional_dependencies: [pillow]
always_run: true
fail_fast: true # Wait for user to remove the png files
# TODO: debug
# # Convert the pngs to jpgs inside samples folder
# - repo: local
# hooks:
# - id: convert-images
# name: Convert png to jpg in samples
# entry: scripts/hooks/convert_images_hook.py
# # TODO: support for imports inside pre-commit
# # env:
# # PYTHONPATH: $PYTHONPATH:$PWD
# args: ["--trigger-size", "150"]
# files: ^samples.*\.(png|PNG)$
# pass_filenames: true
# stages: [commit]
# language: python
# language_version: python3
# additional_dependencies: [pillow]
# always_run: true
# fail_fast: true # Wait for user to remove the png files

# Run resize image before the compress image check
- repo: local
hooks:
- id: resize-images
name: Resize images
entry: scripts/hooks/resize_images_hook.py
args: ["--max-width", "1500", "--max-height", "1500", "--trigger-size", "150"]
files: \.(png|jpg|jpeg|PNG|JPG|JPEG)$
pass_filenames: true
stages: [commit]
language: python
language_version: python3
additional_dependencies: [pillow]
always_run: true
fail_fast: false
# # Run resize image before the compress image check
# - repo: local
# hooks:
# - id: resize-images
# name: Resize images
# entry: scripts/hooks/resize_images_hook.py
# env:
# PYTHONPATH: $PYTHONPATH:./scripts
# args: ["--max-width", "1500", "--max-height", "1500", "--trigger-size", "150"]
# files: \.(png|jpg|jpeg|PNG|JPG|JPEG)$
# pass_filenames: true
# stages: [commit]
# language: python
# language_version: python3
# additional_dependencies: [pillow]
# always_run: true
# fail_fast: false

# Run image compressor before the large files check
- repo: https://github.com/boidolr/pre-commit-images
Expand Down Expand Up @@ -92,7 +98,7 @@ repos:
hooks:
- id: pytest-on-commit
name: Running single sample test
entry: python3 -m pytest -rfpsxEX --disable-warnings --verbose -k test_run_omr_marker_mobile
entry: pytest -rfpsxEX --disable-warnings --verbose -k test_run_omr_marker_mobile
language: system
pass_filenames: false
always_run: true
Expand All @@ -102,7 +108,7 @@ repos:
hooks:
- id: pytest-on-push
name: Running all tests before push...
entry: python3 -m pytest -rfpsxEX --disable-warnings --verbose --durations=3
entry: ./scripts/run_coverage.sh
language: system
pass_filenames: false
always_run: true
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ OMR stands for Optical Mark Recognition, used to detect and interpret human-mark
[![GitHub pull-requests closed](https://img.shields.io/github/issues-pr-closed/Udayraj123/OMRChecker.svg)](https://github.com/Udayraj123/OMRChecker/pulls?q=is%3Aclosed)
[![GitHub issues-closed](https://img.shields.io/github/issues-closed/Udayraj123/OMRChecker.svg)](https://GitHub.com/Udayraj123/OMRChecker/issues?q=is%3Aissue+is%3Aclosed)
[![Ask me](https://img.shields.io/badge/Discuss-on_Github-purple.svg?style=flat-square)](https://github.com/Udayraj123/OMRChecker/issues/5)
<!-- [![GitHub contributors](https://img.shields.io/github/contributors/Udayraj123/OMRChecker.svg)](https://GitHub.com/Udayraj123/OMRChecker/graphs/contributors/) -->

[![GitHub stars](https://img.shields.io/github/stars/Udayraj123/OMRChecker.svg?style=social&label=Stars✯)](https://GitHub.com/Udayraj123/OMRChecker/stargazers/)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FUdayraj123%2FOMRChecker&count_bg=%2379C83D&title_bg=%23555555&icon=googlecast.svg&icon_color=%23E7E7E7&title=hits%2829.09.2022%29&edge_flat=false)](https://hits.seeyoufarm.com)
Expand Down Expand Up @@ -337,6 +336,12 @@ Here's a snapshot of the [Android OMR Helper App (archived)](https://github.com/
<img src="https://contrib.rocks/image?repo=Udayraj123/OMRChecker" />
</a>

<p align="center">

[![GitHub contributors](https://img.shields.io/github/contributors/Udayraj123/OMRChecker.svg)](https://GitHub.com/Udayraj123/OMRChecker/graphs/contributors/)

</p>

---

### License
Expand Down
10 changes: 10 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ def parse_args():
help="Specify an output directory.",
)

argparser.add_argument(
"-m",
"--outputMode",
default="default",
required=False,
choices=["moderation", "default"],
dest="output_mode",
help="Specify the output mode. Supported: moderation, default",
)

argparser.add_argument(
"-l",
"--setLayout",
Expand Down
1 change: 1 addition & 0 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ freezegun==1.4.0
pre-commit==3.7.0
pytest-mock==3.14.0
pytest==8.1.1
coverage==7.6.0
syrupy==4.6.1
Pillow==10.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
1000,
1300
],
"show_image_level": 5
"show_image_level": 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"warpMethod": "REMAP"
},
"defaultSelector": "OUTER_CORNERS",
"scanAreas": [
"scanZones": [
{
"areaTemplate": "topLeftDot",
"areaDescription": {
"zonePreset": "topLeftDot",
"zoneDescription": {
"label": "AdditionalPoint",
"origin": [
48,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"warpMethod": "HOMOGRAPHY"
},
"defaultSelector": "OUTER_CORNERS",
"scanAreas": [
"scanZones": [
{
"areaTemplate": "topLeftDot",
"areaDescription": {
"zonePreset": "topLeftDot",
"zoneDescription": {
"label": "AdditionalPoint",
"origin": [
48,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"warpMethod": "HOMOGRAPHY"
},
"defaultSelector": "OUTER_CORNERS",
"scanAreas": [
"scanZones": [
{
"areaTemplate": "topLeftDot",
"areaDescription": {
"zonePreset": "topLeftDot",
"zoneDescription": {
"label": "AdditionalPoint",
"origin": [
48,
Expand Down
11 changes: 11 additions & 0 deletions samples/experimental/2-template-shifts/alignment/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"outputs": {
"display_image_dimensions": [
1000,
1300
],
"save_detections": true,
"save_image_level": 0,
"show_image_level": 0
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading