diff --git a/zesje/images.py b/zesje/images.py index 05acb9eb2b6e4edfb3b53467dce4eeb3226ce880..469cf9d093e8d9870705264de6f420cae38d0b54 100644 --- a/zesje/images.py +++ b/zesje/images.py @@ -4,6 +4,7 @@ import numpy as np from operator import sub, add + def guess_dpi(image_array): h, *_ = image_array.shape resolutions = np.array([1200, 600, 400, 300, 200, 150, 120, 100, 75, 60, 50, 40]) diff --git a/zesje/pregrader.py b/zesje/pregrader.py index 440159681bf921fccb5fe30bad0632575f40e397..269c81be83c9f7b35f6c671a1a62ecfc2ddcdf3e 100644 --- a/zesje/pregrader.py +++ b/zesje/pregrader.py @@ -53,13 +53,13 @@ def box_is_filled(box, page_img, corner_keypoints, marker_margin=72/2.54, thresh page_img: np.array A numpy array of the image scan corner_keypoints: (float,float) - The x coordinate of the left markers and the y coordinate of the top markers, - used as point of reference since scans can deviate from the original. + The x coordinate of the left markers and the y coordinate of the top markers, + used as point of reference since scans can deviate from the original. (x,y) are both in pixels. marker_margin: float The margin between the corner markers and the edge of a page when generated. threshold: int - the threshold needed for a checkbox to be considered marked range is between 0 (fully black) + the threshold needed for a checkbox to be considered marked range is between 0 (fully black) and 255 (absolutely white). cut_padding: float The extra padding when retrieving an area where the checkbox is in inches. @@ -139,11 +139,3 @@ def box_is_filled(box, page_img, corner_keypoints, marker_margin=72/2.54, thresh if res_x < 0.333 * box_size_px or res_y < 0.333 * box_size_px: return True return np.average(res_rect) < threshold - - -def box_is_filled(box, page_img, marker_position, marker_margin=72/2.54): - pass - - -def _locate_checkbox(): - pass