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.
This commit is contained in:
Muhammad Abdullah 2017-11-08 15:46:35 -08:00 committed by Alexander Alekhin
parent 51cef2651e
commit c180047bc1

View File

@ -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()