Skip to content

cv异常 #1

@leeformoney

Description

@leeformoney

您好:
我发现在用自己的视频,在对倒数第几张进行处理的时候,OpenCV会报错cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\resize.cpp:4052: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'
于是,将81行代码改为
if alpha<frame<video_length-alpha:
ret, cur_frame = cap.read()
try:
if height != out_height or width != out_width:
cur_frame = cv2.resize(cur_frame,(out_width,out_height),interpolation=cv2.INTER_LANCZOS4)
if not ret or cur_frame is None:
break
except :
continue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions