Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
zesje
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Works on my machine
zesje
Commits
61155f45
Commit
61155f45
authored
5 years ago
by
Ruben Young On
Browse files
Options
Downloads
Patches
Plain Diff
Added function that fixes corner markers
parent
49da2683
No related branches found
No related tags found
1 merge request
!17
Add pregrading
Pipeline
#17906
failed
5 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
zesje/pregrader.py
+5
-3
5 additions, 3 deletions
zesje/pregrader.py
with
5 additions
and
3 deletions
zesje/pregrader.py
+
5
−
3
View file @
61155f45
...
...
@@ -14,7 +14,7 @@ import cv2
import
numpy
as
np
from
zesje.database
import
db
,
Solution
,
Problem
from
zesje.images
import
guess_dpi
,
get_box
from
zesje.images
import
guess_dpi
,
get_box
,
fix_corner_markers
def
add_feedback_to_solution
(
page
,
page_img
,
corner_keypoints
):
...
...
@@ -34,6 +34,8 @@ def add_feedback_to_solution(page, page_img, corner_keypoints):
box
=
(
mc_option
.
x
,
mc_option
.
y
)
corner_keypoints
=
fix_corner_markers
(
corner_keypoints
,
image
=
page_img
,
image_format
=
1
)
# check if box is filled
if
box_is_filled
(
box
,
page_img
,
corner_keypoints
):
sol
.
feedback
.
append
(
mc_option
.
feedback
)
...
...
@@ -134,9 +136,9 @@ def box_is_filled(box, page_img, corner_keypoints, marker_margin=72/2.54, thresh
# if the found box is smaller than a certain threshold
# it means that we only found a little bit of white and the box is filled
res_x
,
res_y
,
*
_
=
res_rect
.
shape
if
(
res_x
<
0.333
*
box_size_px
or
res_y
<
0.333
*
box_size_px
)
:
if
res_x
<
0.333
*
box_size_px
or
res_y
<
0.333
*
box_size_px
:
return
True
return
(
np
.
average
(
res_rect
)
<
225
)
return
np
.
average
(
res_rect
)
<
threshold
def
box_is_filled
(
box
,
page_img
,
marker_position
,
marker_margin
=
72
/
2.54
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment