zoukankan      html  css  js  c++  java
  • calcOpticalFlowFarneback

    calcOpticalFlowFarneback

    Computes a dense optical flow using the Gunnar Farneback’s algorithm.

    C++: void calcOpticalFlowFarneback(InputArray prev, InputArray next, InputOutputArray flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags)
    C: void cvCalcOpticalFlowFarneback(const CvArr* prev, const CvArr* next, CvArr* flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags)
    Python: cv2.calcOpticalFlowFarneback(prev, next, flow, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags) → flow
    Parameters:
    • prev – first 8-bit single-channel input image.
    • next – second input image of the same size and the same type as prev.
    • flow – computed flow image that has the same size as prev and type CV_32FC2.
    • pyr_scale – parameter, specifying the image scale (<1) to build pyramids for each image; pyr_scale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous one.
    • levels – number of pyramid layers including the initial image; levels=1 means that no extra layers are created and only the original images are used.
    • winsize – averaging window size; larger values increase the algorithm robustness to image noise and give more chances for fast motion detection, but yield more blurred motion field.
    • iterations – number of iterations the algorithm does at each pyramid level.
    • poly_n – size of the pixel neighborhood used to find polynomial expansion in each pixel; larger values mean that the image will be approximated with smoother surfaces, yielding more robust algorithm and more blurred motion field, typically poly_n =5 or 7.
    • poly_sigma – standard deviation of the Gaussian that is used to smooth derivatives used as a basis for the polynomial expansion; for poly_n=5, you can set poly_sigma=1.1, for poly_n=7, a good value would be poly_sigma=1.5.
    • flags –

      operation flags that can be a combination of the following:

      • OPTFLOW_USE_INITIAL_FLOW uses the input flow as an initial flow approximation.
      • OPTFLOW_FARNEBACK_GAUSSIAN uses the Gaussian 	exttt{winsize}	imes	exttt{winsize} filter instead of a box filter of the same size for optical flow estimation; usually, this option gives z more accurate flow than with a box filter, at the cost of lower speed; normally, winsize for a Gaussian window should be set to a larger value to achieve the same level of robustness.

    The function finds an optical flow for each prev pixel using the [Farneback2003] algorithm so that

    	exttt{prev} (y,x)  sim 	exttt{next} ( y + 	exttt{flow} (y,x)[1],  x + 	exttt{flow} (y,x)[0])

    Note

    • An example using the optical flow algorithm described by Gunnar Farneback can be found at opencv_source_code/samples/cpp/fback.cpp
    • (Python) An example using the optical flow algorithm described by Gunnar Farneback can be found at opencv_source_code/samples/python2/opt_flow.py
  • 相关阅读:
    现代软件工程 第一周博客作业
    现代软件工程 课题初步调研 在线即时评教系统
    php判断网页是否gzip压缩
    采集练习(五) php 获得chrome扩展 微度新标签页 下的云壁纸(主要是美女壁纸)
    <raspberry pi> raspberry pi 设置wlan 静态ip
    采集练习(三) php 采集当当网图书的数据(初版)
    采集练习(六) python获得chrome扩展 微度新标签页 下的云壁纸
    采集练习(七) php 获得电视节目预告(一周节目)
    采集练习(八) php 获得网易精彩跟贴数据
    采集练习(四) python 获得hao123导航图片分类下的美女图片
  • 原文地址:https://www.cnblogs.com/casperwin/p/6557662.html
Copyright © 2011-2022 走看看