From 881c3f13af192014b06c56ac4a412cba8e92b5b4 Mon Sep 17 00:00:00 2001 From: Ali Mostafa Radwan <66019196+AliMostafaRadwan@users.noreply.github.com> Date: Wed, 18 Sep 2024 00:48:29 +0300 Subject: [PATCH] updated get_blend_mask method to accept float numbers for the x and y to fix (Can't parse 'pt'. Sequence item with index 0 has a wrong type) error --- SurroundBirdEyeView/surroundBEV.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SurroundBirdEyeView/surroundBEV.py b/SurroundBirdEyeView/surroundBEV.py index aac96b3..3715825 100644 --- a/SurroundBirdEyeView/surroundBEV.py +++ b/SurroundBirdEyeView/surroundBEV.py @@ -12,7 +12,7 @@ parser.add_argument('-ch', '--CAR_HEIGHT', default=400, type=int, help='Car Frame Height') parser.add_argument('-fs', '--FOCAL_SCALE', default=1, type=float, help='Camera Undistort Focal Scale') parser.add_argument('-ss', '--SIZE_SCALE', default=2, type=float, help='Camera Undistort Size Scale') -parser.add_argument('-blend','--BLEND_FLAG', default=False, type=bool, help='Blend BEV Image (Ture/False)') +parser.add_argument('-blend','--BLEND_FLAG', default=True, type=bool, help='Blend BEV Image (Ture/False)') parser.add_argument('-balance','--BALANCE_FLAG', default=False, type=bool, help='Balance BEV Image (Ture/False)') args = parser.parse_args() @@ -271,8 +271,9 @@ def get_blend_mask(self, maskA, maskB, lineA, lineB): overlap = cv2.bitwise_and(maskA, maskB) indices = np.where(overlap != 0) for y, x in zip(*indices): - distA = cv2.pointPolygonTest(np.array(lineA), (x, y), True) - distB = cv2.pointPolygonTest(np.array(lineB), (x, y), True) + # Change the order of x and y in the point tuple + distA = cv2.pointPolygonTest(np.array(lineA), (float(x), float(y)), True) + distB = cv2.pointPolygonTest(np.array(lineB), (float(x), float(y)), True) maskA[y, x] = distA**2 / (distA**2 + distB**2 + 1e-6) * 255 return maskA