• OpenCv 013---图像的翻转


    1 前备知识

    null

    2 所用到的主要OpenCv API

    /** @brief Flips a 2D array around vertical, horizontal, or both axes.

    @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
    */

    CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode);

    3 程序代码

    #include<opencv2opencv.hpp>
    #include<iostream>
    
    using namespace std;
    using namespace cv;
    
    int main(int argc, char** argv)
    {
        Mat src = imread("G:\CVworkstudy\program_wwx\研习社140课时\ZhaiZhigang140\lena.jpg");
        if (src.empty())
        {
            cout << "Could not load image..." << endl;
            return false;
        }
        namedWindow("srcImg");
        imshow("srcImg", src);
        Mat flipX, flipY, flipXY;
        //延X轴镜像翻转
        flip(src, flipX, 0);
        //延Y轴镜像翻转
        flip(src, flipY, 1);
        //延XY方向镜像翻转(对角翻转)
        flip(src, flipXY, -1);
        //结果显示
        imshow("flipXDst", flipX);
        imshow("flipYDst", flipY);
        imshow("flipXYDst", flipXY);
    
        waitKey(0);
        return 0;
    }

    4 运行结果

    5 扩展及注意事项

    null

    One day,I will say "I did it"
  • 相关阅读:
    oracle外连接 (+)
    Struts 2的架构和运行流程
    struts2.3.15.1 中jsp:include与jsp:forward的用法
    tomcat6.0添加ssi(*.shtml)配置
    DWZ 刷新 dialog
    java将多个连续的空格转化成一个空格
    IE下不支持option的onclick事件
    struts2中的常量
    java.imageIo给图片添加水印
    java集合的互转
  • 原文地址:https://www.cnblogs.com/Vince-Wu/p/11183361.html
Copyright © 2020-2023  润新知