Skip to content

Commit

Permalink
Merge pull request Udayraj123#18 from Udayraj123/dev
Browse files Browse the repository at this point in the history
Fix errors for running samples
  • Loading branch information
Udayraj123 authored Dec 15, 2019
2 parents 80fd067 + 0b2aaee commit e0f1e81
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Binary file modified samples/sample4/Class1/sheet1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion template.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def __init__(self, path):
markerOps = self.options["Marker"]
self.marker_path = os.path.join(
os.path.dirname(path), markerOps.get(
"RelativePath", MARKER_FILE))
"RelativePath", config.MARKER_FILE))
if(not os.path.exists(self.marker_path)):
print(
"Error: Marker not found at path provided in template:",
Expand Down
14 changes: 5 additions & 9 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,24 @@
# for positioning image windows
windowX,windowY = 0,0


# In[62]:
import re
import os
import sys
import cv2
import glob
import imutils
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (10.0, 8.0)

from pathlib import Path
from random import randint
from time import localtime,strftime,time
from imutils import grab_contours
# from skimage.filters import threshold_adaptive
from pathlib import Path

import config
import template


def setup_dirs(paths):
print('\nChecking Directories...')
for _dir in [paths.saveMarkedDir]:
Expand Down Expand Up @@ -180,7 +176,7 @@ def drawTemplateLayout(
if(draw_qvals):
rect = [y, y + boxH, x, x + boxW]
cv2.putText(final_align,
'%d'% (cv2.mean(img[rect[0]:rect[1], rect[2]:rect[3])[0]),
'%d'% (cv2.mean(img[rect[0]:rect[1], rect[2]:rect[3]])[0]),
(rect[2] + 2, rect[0] + (boxH * 2) // 3),
cv2.FONT_HERSHEY_SIMPLEX,
0.6,
Expand Down Expand Up @@ -374,7 +370,7 @@ def findPage(image_norm):

# findContours returns outer boundaries in CW and inner boundaries in ACW
# order.
cnts = imutils.grab_contours(
cnts = grab_contours(
cv2.findContours(
edge,
cv2.RETR_LIST,
Expand Down Expand Up @@ -549,7 +545,7 @@ def handle_markers(image_norm, marker, curr_filename):
show('Quads', image_eroded_sub)
return None

optimal_marker = imutils.resize_util_h(
optimal_marker = resize_util_h(
marker if config.ERODE_SUB_OFF else marker, u_height=int(
marker.shape[0] * best_scale))
h, w = optimal_marker.shape[:2]
Expand Down

0 comments on commit e0f1e81

Please sign in to comment.