Skip to content

Commit 39c6c69

Browse files
committed
fix Deprecation Warning on conversion of tuple to scalar
Error: /home/toby/mobile/teaching/durham/cv/python-examples-cv/./kalman_tracking_live.py:326: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) (int(prediction[0] - (0.5 * w)), /home/toby/mobile/teaching/durham/cv/python-examples-cv/./kalman_tracking_live.py:327: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) int(prediction[1] - (0.5 * h))), /home/toby/mobile/teaching/durham/cv/python-examples-cv/./kalman_tracking_live.py:328: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) (int(prediction[0] + (0.5 * w)), /home/toby/mobile/teaching/durham/cv/python-examples-cv/./kalman_tracking_live.py:329: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) int(prediction[1] + (0.5 * h))),
1 parent 55c3963 commit 39c6c69

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kalman_tracking_live.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,10 @@ def nothing(x):
321321
# draw predicton on image - in GREEN
322322

323323
frame = cv2.rectangle(frame,
324-
(int(prediction[0] - (0.5 * w)),
325-
int(prediction[1] - (0.5 * h))),
326-
(int(prediction[0] + (0.5 * w)),
327-
int(prediction[1] + (0.5 * h))),
324+
(int(prediction[0][0] - (0.5 * w)),
325+
int(prediction[1][0] - (0.5 * h))),
326+
(int(prediction[0][0] + (0.5 * w)),
327+
int(prediction[1][0] + (0.5 * h))),
328328
(0,
329329
255,
330330
0),

0 commit comments

Comments
 (0)