title: Drawing bounding box based on optical flow
body: <p>Based on <a href="https://www.mathworks.com/help/vision/ref/opticalflowhs.estimateflow.html" rel="nofollow noreferrer">https://www.mathworks.com/help/vision/ref/opticalflowhs.estimateflow.html</a> I am able to get the optical flow vectors. I want to use this flow information to compute a bounding box over my image, so I took the maximum of the returned matrix to fit them into a bounding box. However no bounding box is being printed.</p>
  <pre><code>nFrames = 0;
  while (nFrames&lt;100)
      frameRGB = vidDevice();
  
      % Compute optical flow for frame.
      flow = estimateFlow(opticFlow,rgb2gray(frameRGB));
  
      maxFlowVx = max(flow.Vx);
      maxFlowVy = max(flow.Vy);
      bbox = [maxFlowVx(1:2), maxFlowVy(1:2)];
      annotatedImage = insertShape(frameRGB,&quot;rectangle&quot;,bbox,&quot;LineWidth&quot;,8);
      
      imshow(annotatedImage)
  
      hold on
      plot(flow,'DecimationFactor',[5 5],'ScaleFactor',25)
      hold off
  
      % Increment frame count
      nFrames = nFrames + 1;
  end
  </code></pre>