• opencv-学习笔记


    opencv——反转函数的定义

    CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode);
    /** @brief Flips a 2D array around vertical, horizontal, or both axes.
    
    The function flip flips the array in one of three different ways (row
    and column indices are 0-based):
    f[	exttt{dst} _{ij} =
    left{
    egin{array}{l l}
    	exttt{src} _{	exttt{src.rows}-i-1,j} & if;  	exttt{flipCode} = 0 \
    	exttt{src} _{i, 	exttt{src.cols} -j-1} & if;  	exttt{flipCode} > 0 \
    	exttt{src} _{ 	exttt{src.rows} -i-1, 	exttt{src.cols} -j-1} & if; 	exttt{flipCode} < 0 \
    end{array}
    
    ight.f]
    The example scenarios of using the function are the following:
    *   Vertical flipping of the image (flipCode == 0) to switch between
        top-left and bottom-left image origin. This is a typical operation
        in video processing on Microsoft Windows* OS.
    *   Horizontal flipping of the image with the subsequent horizontal
        shift and absolute difference calculation to check for a
        vertical-axis symmetry (flipCode > 0).
    *   Simultaneous horizontal and vertical flipping of the image with
        the subsequent shift and absolute difference calculation to check
        for a central symmetry (flipCode < 0).
    *   Reversing the order of point arrays (flipCode > 0 or
        flipCode == 0).
    @param src input array.
    @param dst output array of the same size and type as src.
    @param flipCode a flag to specify how to flip the array; 0 means
    flipping around the x-axis and positive value (for example, 1) means
    flipping around y-axis. Negative value (for example, -1) means flipping
    around both axes.
    @sa transpose , repeat , completeSymm
    */

    现在讨论其中的参数InputArray和OutputArray。

     nputArray这个接口类可以是Mat、Mat_<T>、Mat_<T, m, n>、vector<T>、vector<vector<T>>、vector<Mat>。也就意味着当你看refman或者源代码时,如果看见函数的参数类型是InputArray型时,把上诉几种类型作为参数都是可以的。

    有时候InputArray输入的矩阵是个空参数,你只需要用cv::noArray()作为参数即可,或者很多代码里都用cv::Mat()作为空参。

    这个类只能作为函数的形参参数使用,不要试图声明一个InputArray类型的变量

    https://blog.csdn.net/yang_xian521/article/details/7755101

  • 相关阅读:
    448. Find All Numbers Disappeared in an Array
    447. Number of Boomerangs
    441. Arranging Coins
    438. Find All Anagrams in a String
    437. Path Sum III
    434. Number of Segments in a String
    422. Valid Word Square
    415. Add Strings
    414. Third Maximum Number
    [codility]Array-closest-ascenders
  • 原文地址:https://www.cnblogs.com/implus/p/13701038.html
Copyright © 2020-2023  润新知