c# OpenCvSharp 图像翻转 Flip

c# OpenCvSharp 图像翻转 Flip

using OpenCvSharp;
using OpenCvSharp.Extensions;
using DlibDotNet;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;

namespace app
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();
        }


        /// <summary>
        /// 水平翻转
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFlipX_Click(object sender, EventArgs e)
        {
            Mat src = Cv2.ImRead(@"img\jzh.png");
            Mat dest = new Mat();
            // 水平翻转
            Cv2.Flip(src, dest, FlipMode.Y);

            Cv2.ImShow("src", src);

            Cv2.ImShow("dest", dest);

            //this.picDest.Image = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(dest);
        }

        /// <summary>
        /// 垂直翻转
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFlipY_Click(object sender, EventArgs e)
        {
            Mat src = Cv2.ImRead(@"img\jzh.png");
            Mat dest = new Mat();
            // 垂直翻转
            Cv2.Flip(src, dest, FlipMode.X);

            Cv2.ImShow("src", src);

            Cv2.ImShow("dest", dest);
        }

    }
}

 

发表回复

您的电子邮箱地址不会被公开。