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.
pull/10055/head
Muhammad Abdullah 7 years ago committed by Alexander Alekhin
parent 51cef2651e
commit c180047bc1
  1. 3
      samples/python/digits_video.py

@ -55,7 +55,7 @@ def main():
if not (16 <= h <= 64 and w <= 1.2*h):
continue
pad = max(h-w, 0)
x, w = x-pad/2, w+pad
x, w = x - (pad // 2), w + pad
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0))
bin_roi = bin[y:,x:][:h,:w]
@ -98,3 +98,4 @@ def main():
if __name__ == '__main__':
main()
cv2.destroyAllWindows()

Loading…
Cancel
Save