diff --git a/douyin/detection/douyin_pixel.py b/douyin/detection/douyin_pixel.py index 7055585..6d62d46 100644 --- a/douyin/detection/douyin_pixel.py +++ b/douyin/detection/douyin_pixel.py @@ -85,7 +85,7 @@ def detect_coupon_popup_background( return False bgr = cv2.cvtColor( # type: ignore[attr-defined] - np.array(pic_rgb), cv2.COLOR_RGB2BGR # type: ignore[attr-defined] + np.asarray(pic_rgb), cv2.COLOR_RGB2BGR # type: ignore[attr-defined] ) roi = bgr[y1:y2, x1:x2] # type: ignore[index] if roi.size == 0: @@ -230,7 +230,7 @@ def detect_redpacket_popup_background( # 裁剪感兴趣区域 roi = pic_rgb.crop((x1, y1, x2, y2)) - arr = np.array(roi) + arr = np.asarray(roi) if arr.size == 0: if return_info: @@ -834,10 +834,10 @@ def detect_live_room_icons_by_pixel(pic_rgb: Image.Image) -> tuple[bool, float]: draw.polygon(polygon_points, fill=255) # 将mask转换为numpy数组 - mask_array = np.array(mask) + mask_array = np.asarray(mask) # 获取原始图像的像素数据 - img_array = np.array(pic_rgb) + img_array = np.asarray(pic_rgb) # 计算多边形内部的总像素数 total_pixels = np.sum(mask_array > 0)