Skip to content

Commit c180047

Browse files
abi98213alalek
authored andcommitted
update digits_video.py
Following were the errors in the digits_video.py 1 ) The code was not working because data type of x was float however in "cv2.rectangle" we require integer . 2 ) After pressing the "esc" button the image windows did not destroy So I amended following things: 1 ) ~converted data type of x to int.~ Used Python integer division (//) 2 ) used cv2.destroyAllWindows() to close all windows after the press of "esc" by user.
1 parent 51cef26 commit c180047

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

samples/python/digits_video.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def main():
5555
if not (16 <= h <= 64 and w <= 1.2*h):
5656
continue
5757
pad = max(h-w, 0)
58-
x, w = x-pad/2, w+pad
58+
x, w = x - (pad // 2), w + pad
5959
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0))
6060

6161
bin_roi = bin[y:,x:][:h,:w]
@@ -98,3 +98,4 @@ def main():
9898

9999
if __name__ == '__main__':
100100
main()
101+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)