update menti
This commit is contained in:
12
utils.py
12
utils.py
@@ -61,18 +61,20 @@ def check_for_bl_line(line_item, black_list):
|
||||
return False
|
||||
|
||||
|
||||
def scale_screenshot(screenshot):
|
||||
scale_percent = 200 # percent of original size
|
||||
def scale_screenshot(screenshot, percent = 200, thresh_mode = True):
|
||||
scale_percent = percent # percent of original size
|
||||
width = int(screenshot.shape[1] * scale_percent / 100)
|
||||
height = int(screenshot.shape[0] * scale_percent / 100)
|
||||
dim = (width, height)
|
||||
resized_img = cv.resize(screenshot, dim, interpolation=4)
|
||||
|
||||
gray = cv.cvtColor(resized_img, cv.COLOR_BGR2GRAY)
|
||||
thresh = cv.threshold(gray, 0, 255, cv.THRESH_BINARY_INV + cv.THRESH_OTSU)[1]
|
||||
if thresh_mode:
|
||||
gray = cv.cvtColor(resized_img, cv.COLOR_BGR2GRAY)
|
||||
thresh = cv.threshold(gray, 0, 255, cv.THRESH_BINARY_INV + cv.THRESH_OTSU)[1]
|
||||
return thresh
|
||||
# cv.imshow("Tresh", thresh)
|
||||
# cv.waitKey(1000)
|
||||
return thresh
|
||||
return resized_img
|
||||
|
||||
|
||||
def save_line_item_npy_jpg(short_pic_list):
|
||||
|
||||
Reference in New Issue
Block a user