opencv透视变换报错

cnts = cv2.findContours(edged.copy(),cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE)[1]
cnts = sorted(cnts,key = cv2.contourArea,reverse = True)[:5]

for c in cnts:
peri = cv2.arcLength(c,True)

approx = cv2.approxPolyDP(c,0.02 * peri,True)

if len(approx) == 4:
    screenCnt = approx
    break

报错: cnts = sorted(cnts,key = cv2.contourArea,reverse = True)[:5]
cv2.error: OpenCV(4.5.4) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\shapedescr.cpp:315: error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function 'cv::contourArea'