C# using OpenCv (OpenCVSharp) image contour polygon approximation and contour minimum rectangle example

The example in this article demonstrates how to use OpenCv (OpenCVSharp) in C# language to approximate the image outline polygon and outline the minimum rectangle example.

The purpose of polygon approximation is to reduce the number of points in the contour, but the shape of the contour looks similar.

Minimal rectangle: a rectangle with a smaller area that surrounds the outline. Example

Create a winform project and add controls and events

 

 

Add class

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;

using OpenCvSharp;//为了使用opencv
using CvPoint = OpenCvSharp.Point;//为了确定我们使用的point是opencv的而不是draw的
using CvSize = OpenCvSharp.Size;//为了确定我们使用的point是opencv的而不是draw的
using DPoint = System

Guess you like

Origin blog.csdn.net/qq_30725967/article/details/133030716