neozhaoliang / surround-view-system-introduction

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

python run_get_weight_matrices.py报错 #35

Closed Francis235 closed 1 year ago

Francis235 commented 2 years ago

Traceback (most recent call last): File "/home/ai2/work/surround-view-system-introduction/run_get_weight_matrices.py", line 36, in main() File "/home/ai2/work/surround-view-system-introduction/run_get_weight_matrices.py", line 24, in main Gmat, Mmat = birdview.get_weights_and_masks(projected) File "/home/ai2/work/surround-view-system-introduction/surround_view/birdview.py", line 301, in get_weights_and_masks G0, M0 = utils.get_weight_mask_matrix(FI(front), LI(left)) File "/home/ai2/work/surround-view-system-introduction/surround_view/utils.py", line 115, in get_weight_mask_matrix distToB = cv2.pointPolygonTest(polyB, (x, y), True) cv2.error: OpenCV(4.6.0) :-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

解决办法: for y, x in zip(indices): distToB = cv2.pointPolygonTest(polyB, (int(x), int(y)), True) if distToB < dist_threshold: distToA = cv2.pointPolygonTest(polyA, (int(x), int(y)), True) distToB = distToB distToA *= distToA G[y, x] = distToB / (distToA + distToB)

DWendou commented 2 years ago

Traceback (most recent call last): File "/home/ai2/work/surround-view-system-introduction/run_get_weight_matrices.py", line 36, in main() File "/home/ai2/work/surround-view-system-introduction/run_get_weight_matrices.py", line 24, in main Gmat, Mmat = birdview.get_weights_and_masks(projected) File "/home/ai2/work/surround-view-system-introduction/surround_view/birdview.py", line 301, in get_weights_and_masks G0, M0 = utils.get_weight_mask_matrix(FI(front), LI(left)) File "/home/ai2/work/surround-view-system-introduction/surround_view/utils.py", line 115, in get_weight_mask_matrix distToB = cv2.pointPolygonTest(polyB, (x, y), True) cv2.error: OpenCV(4.6.0) -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

解决办法: for y, x in zip(indices): distToB = cv2.pointPolygonTest(polyB, (int(x), int(y)), True) if distToB < dist_threshold: distToA = cv2.pointPolygonTest(polyA, (int(x), int(y)), True) distToB = distToB distToA *= distToA G[y, x] = distToB / (distToA + distToB)

Traceback (most recent call last): File "/home/ai2/work/surround-view-system-introduction/run_get_weight_matrices.py", line 36, in main() File "/home/ai2/work/surround-view-system-introduction/run_get_weight_matrices.py", line 24, in main Gmat, Mmat = birdview.get_weights_and_masks(projected) File "/home/ai2/work/surround-view-system-introduction/surround_view/birdview.py", line 301, in get_weights_and_masks G0, M0 = utils.get_weight_mask_matrix(FI(front), LI(left)) File "/home/ai2/work/surround-view-system-introduction/surround_view/utils.py", line 115, in get_weight_mask_matrix distToB = cv2.pointPolygonTest(polyB, (x, y), True) cv2.error: OpenCV(4.6.0) -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

解决办法: for y, x in zip(indices): distToB = cv2.pointPolygonTest(polyB, (int(x), int(y)), True) if distToB < dist_threshold: distToA = cv2.pointPolygonTest(polyA, (int(x), int(y)), True) distToB = distToB distToA *= distToA G[y, x] = distToB / (distToA + distToB)

你这个是opencv版本太高了,降低版本就可以了,我用的4.2.0.34就没问题。