freealise commited on
Commit
3ac632f
1 Parent(s): 3a60572

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -144,7 +144,7 @@ def infer(url_in,interpolation,fps_output,resize_n,winsize):
144
  if ret == False:
145
  break
146
  nxt = cv2.cvtColor(fr2, cv2.COLOR_RGBA2GRAY)
147
- fl = cv2.calcOpticalFlowFarneback(prvs, nxt, flow, 0.5, 4, winsize, 4, 7, 1.5, 0)
148
  mag, ang = cv2.cartToPolar(fl[..., 0], fl[..., 1])
149
  hsv[..., 0] = ang*180/np.pi/2
150
  hsv[..., 2] = cv2.normalize(mag, None, 0, 255, cv2.NORM_MINMAX)
@@ -196,7 +196,7 @@ with gr.Blocks() as demo:
196
  with gr.Column():
197
  url_input = gr.Textbox(value="./examples/streetview.mp4", label="URL")
198
  resize_num = gr.Slider(minimum=1, maximum=4096, step=1, value=256, label="Resize to width: ")
199
- winsize_num = gr.Slider(minimum=1, maximum=256, step=1, value=9, label="Motion detection window size: ")
200
  with gr.Row():
201
  interpolation_slider = gr.Slider(minimum=1, maximum=5, step=1, value=1, label="Interpolation Steps: ")
202
  interpolation = gr.Label(value=2, show_label=False)
 
144
  if ret == False:
145
  break
146
  nxt = cv2.cvtColor(fr2, cv2.COLOR_RGBA2GRAY)
147
+ fl = cv2.calcOpticalFlowFarneback(prvs, nxt, flow, 0.5, 3, winsize, 3, 5, 1.2, 0)
148
  mag, ang = cv2.cartToPolar(fl[..., 0], fl[..., 1])
149
  hsv[..., 0] = ang*180/np.pi/2
150
  hsv[..., 2] = cv2.normalize(mag, None, 0, 255, cv2.NORM_MINMAX)
 
196
  with gr.Column():
197
  url_input = gr.Textbox(value="./examples/streetview.mp4", label="URL")
198
  resize_num = gr.Slider(minimum=1, maximum=4096, step=1, value=256, label="Resize to width: ")
199
+ winsize_num = gr.Slider(minimum=1, maximum=256, step=1, value=15, label="Motion detection window size: ")
200
  with gr.Row():
201
  interpolation_slider = gr.Slider(minimum=1, maximum=5, step=1, value=1, label="Interpolation Steps: ")
202
  interpolation = gr.Label(value=2, show_label=False)