imaneralo commited on
Commit
c0a3be3
1 Parent(s): 51ab369

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -119,13 +119,18 @@ RedLine = [173, 0, 173, 600]
119
  totalCountUp = []
120
  #mask=cv2.imread('mask.jpg')
121
  entry_count = 0
122
-
 
123
  try:
124
  while True:
125
 
126
-
 
 
127
 
128
  success, img = cap.read()
 
 
129
  # imgRegion=cv2.bitwise_and(img,mask)
130
 
131
  results = model(img, stream=True)
 
119
  totalCountUp = []
120
  #mask=cv2.imread('mask.jpg')
121
  entry_count = 0
122
+ total_frames = cap.get(cv2.CAP_PROP_FRAME_COUNT)
123
+ processed_frames = 0
124
  try:
125
  while True:
126
 
127
+ processed_frames+=1
128
+ if(processed_frames>=total_frames):
129
+ break
130
 
131
  success, img = cap.read()
132
+ if not success:
133
+ break
134
  # imgRegion=cv2.bitwise_and(img,mask)
135
 
136
  results = model(img, stream=True)