re-implement equipment with masks

This commit is contained in:
2022-05-15 00:50:42 +02:00
parent e7b15cc48a
commit 883a6f77aa
292 changed files with 454 additions and 173 deletions

View File

@@ -49,7 +49,7 @@ class WindowCapture:
def get_screenshot(self):
def get_screenshot(self, drop_alpha_channel = True):
# get the window image data
wDC = win32gui.GetWindowDC(self.hwnd)
dcObj = win32ui.CreateDCFromHandle(wDC)
@@ -74,7 +74,8 @@ class WindowCapture:
# drop the alpha channel, or cv.matchTemplate() will throw an error like:
# error: (-215:Assertion failed) (depth == CV_8U || depth == CV_32F) && type == _templ.type()
# && _img.dims() <= 2 in function 'cv::matchTemplate'
img = img[...,:3]
if drop_alpha_channel:
img = img[...,:3]
# make image C_CONTIGUOUS to avoid errors that look like:
# File ... in draw_rectangles