neozhaoliang / surround-view-system-introduction

A full Python implementation for real car surround view system
MIT License
871 stars 307 forks source link

The error of "python run_get_weight_matrices.py" #31

Closed acrith2015 closed 2 years ago

acrith2015 commented 2 years ago

Hi, the error when runs "run_get_weight_matrices.py". Please help, thank you very much!

File "run_get_weight_matrices.py", line 36, in main() File "run_get_weight_matrices.py", line 24, in main Gmat, Mmat = birdview.get_weights_and_masks(projected) File "/home/idriver/work/AVP/surround-view-system-introduction-master/surround_view/birdview.py", line 301, in get_weights_and_masks G0, M0 = utils.get_weight_mask_matrix(FI(front), LI(left)) File "/home/idriver/work/AVP/surround-view-system-introduction-master/surround_view/utils.py", line 114, in get_weight_mask_matrix distToB = cv2.pointPolygonTest(polyB, (x, y), True) cv2.error: OpenCV(4.5.5) :-1: error: (-5:Bad argument) in function 'pointPolygonTest'

Overload resolution failed:

  • Can't parse 'pt'. Sequence item with index 0 has a wrong type
  • Can't parse 'pt'. Sequence item with index 0 has a wrong type
acrith2015 commented 2 years ago

There is a solution to this problem: https://stackoverflow.com/questions/67921192/5bad-argument-in-function-rectangle-cant-parse-pt1-sequence-item-wit#

neozhaoliang commented 2 years ago

Hi, since you are using OpenCV 4.5.5, which is a higher version than this repo (4.0.0), I guess the function cv2.pointPolygonTest() expects different types of arguments now. Maybe you can try cv2.pointPolygonTest(polyB, (int(x), int(y)), True) ?

ChirsDejong commented 2 years ago

老师您好,在照着您的建议修改之后,在surround_view\utils.py文件中出现了如下问题C = sorted(cnts, key=lambda x: cv2.contourArea(x), reverse=True)[0]IndexError: list index out of range,请问该如何解决?

neozhaoliang commented 2 years ago

你试试把 sorted(cnts, key=lambda x: cv2.contourArea(x), reverse=True) 结果打印出来,看看返回了一个什么。

shadoubuhuideyy commented 1 year ago

老师您好,在照着您的建议修改之后,在surround_view\utils.py文件中出现了如下问题C = sorted(cnts, key=lambda x: cv2.contourArea(x), reverse=True)[0]IndexError: list index out of range,请问该如何解决?

请问您解决了吗。我目前也是遇到了这个错误