//图像的矩,计算图形的中心
private void btn_moments_Click(object sender, EventArgs e)
{
if (ib_original.Image != null)
{
Mat src = new Image<Bgr, byte>(ib_original.Image.Bitmap).Mat;
Mat dst = new Mat();
CvInvoke.Canny(src, dst, 120, 180);
VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint();
CvInvoke.FindContours(dst, contours, null, Emgu.CV.CvEnum.RetrType.External,
Emgu.CV.CvEnum.ChainApproxMethod.ChainApproxNone);
//筛选出面积不为0的轮廓并画出
VectorOfVectorOfPoint use_contours = new VectorOfVectorOfPoint();
for (int i = 0; i < contours.Size; i++)
{
//获取独立的连通轮廓
VectorOfPoint contour = contours[i];
//计算连通轮廓的面积
double area
EmguCv图像的矩(计算轮廓中心)
最新推荐文章于 2021-10-08 14:48:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)