Commit 76adcc2c authored by Richard's avatar Richard

fix demo hopelijk

parent b3fa241e
Pipeline #18954 failed with stages
in 3 minutes and 26 seconds
......@@ -6,6 +6,7 @@ from .blanks import get_blank
from .database import db, Grader, FeedbackOption, GradingPolicy
from .images import guess_dpi, get_box
from .pdf_generation import CHECKBOX_FORMAT
import sys
def grade_problem(sub, page, page_img):
......@@ -153,11 +154,12 @@ def is_blank(problem, page_img, sub):
while n + 50 < max:
m = n + 50
if np.average(~input_image[n: m]) > (1.03 * np.average(~blank_image[n: m])):
print(f"input: {np.average(~input_image[n: m])}, blank: {np.average(~reference[n: m])}", file=sys.stdout)
if np.average(~input_image[n: m]) > (1.1 * np.average(~blank_image[n: m])) and np.average(~input_image[n: m]) > 1:
return False
n = m
return not(np.average(~input_image[n: max-1]) > (1.03 * np.average(~blank_image[n: max-1])))
print(f"input: {np.average(~input_image[n: max-1])}, blank: {np.average(~blank_image[n: max-1])}", file=sys.stdout)
return not(np.average(~input_image[n: max-1]) > (1.1 * np.average(~blank_image[n: max-1])) and np.average(~input_image[n: max-1]) > 1)
def box_is_filled(box, page_img, threshold=225, cut_padding=0.05, box_size=9):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment