无人机巡线模块报错,ValueError: too many values to unpack (expected 2)

问题遇到的现象和发生背景

这是关于无人机的sdk代码功能,https://www.bilibili.com/video/BV16U4y1j7sE/?spm_id_from=333.1007.top_right_bar_window_history.content.click&vd_source=b28e0276bfb967a2c92452f8fa925d63%EF%BC%8C%E5%85%B3%E4%BA%8E%E5%B7%A1%E7%BA%BF%E5%8A%9F%E8%83%BD%E7%9A%84%E4%BB%A3%E7%A0%81%E6%8A%A5%E9%94%99

用代码块功能插入代码,请勿粘贴截图

import cv2
import numpy as np

cap=cv2.VideoCapture(0)
hsvVals=[0,0,63,179,160,255]

def threading(img):
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)

lower = np.array([hsvVals[0], hsvVals[1], hsvVals[2]])

upper = np.array([hsvVals[3], hsvVals[4], hsvVals[5]])

mask = cv2.inRange(hsv, lower, upper)

return mask

def getContours(imgThres, img):
contours,hieracrhy = cv2.findContours(imgThres, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)#外侧扫描,所有边界点
if len(contours) != 0:
biggest = max(contours, key=cv2.contourArea)

x, y, w, h = cv2.boundingRect(biggest)

cx = x + w // 2

cy = y + h // 2

cv2.drawContours(img, biggest, -1, (255, 0, 255), 7)

cv2.circle(img, (cx, cy), 10, (0, 255, 0), cv2.FILLED)

while True:
_,img=cap.read()
img=cv2.resize(img,(480,360))
#img=cv2.flip(img,0)
imgThres=threading(img)
getContours(imgThres,img)
cv2.imshow('Output',img)
cv2.imshow("Path", imgThres)
cv2.waitKey(1)

运行结果及报错内容

ValueError: too many values to unpack (expected 2)

我的解答思路和尝试过的方法

请问有人知道这是什么情况吗?

我想要达到的结果

消除报错,使程序运行下去