c# OpenCvSharp 画圆 Circle

c# OpenCvSharp 画圆 Circle

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 btnCricle1_Click(object sender, EventArgs e)
        {
            // 创建一张大小为500*500图像
            Mat src = new Mat(500, 500, MatType.CV_8UC3, new Scalar(255, 255, 255));

            // 红色线条
            Scalar color = new Scalar(0, 0, 255);
            // 填充
            Cv2.Circle(src, new OpenCvSharp.Point(100, 100), 50, color, -1);
            // 线条
            Cv2.Circle(src, new OpenCvSharp.Point(250, 250), 50, color, 1, LineTypes.Link8);

            Cv2.ImShow("圆 填充", src);


            Cv2.WaitKey();
        }
    }
}

 

发表回复

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