Lines Matching refs:frame
38 def resize_and_binarize_image(frame, width, height, threshold):
42 frame = cv2.resize(frame, (width, height)) # 缩放
43 frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY) # 转为灰度图
44 _, binary = cv2.threshold(frame, threshold, 255, cv2.THRESH_BINARY) # 二值化
49 pixels = frame[r, colStart: colStart + PIXEL_PER_BYTE]
54 cv2.imwrite(os.path.join('debug', str(frameCount) + '.png'), frame)
61 def convert_frame_to_bytes(frame):
62 return resize_and_binarize_image(frame, TARGET_WIDTH, TARGET_HEIGHT, PIXEL_THRESHOLD)
80 frame = cv2.imread(imgPath) # 加载图片
81 bitmap = resize_and_binarize_image(frame, width, height, threshold) # 转为目标格式的数组