使用EMGUCV进行图像处理的知识点

1、进行图像缩放:

  其是使用CvInvoke.Resize()函数来实现的,其参数为:

其中的Size()函数需要使用命名空间名Drawing否则容易出现重定义。

2、获取图像的ROI区域,方法有很多,这里介绍其中几种:
a、使用Image的内建函数进行获得ROI,这个函数为:GetSubRect():

Rectangle rectangle = new Rectangle(int.Parse(cordinates[1]), int.Parse(cordinates[2]), int.Parse(cordinates[3]), int.Parse(cordinates[4]));
Image<Bgr, byte> Subimg = src.GetSubRect(rectangle);

b、Image变量的第二种方法:

Rectangle rectangle = new Rectangle(x, y, width, height);
flipImage = flipImage.Copy(rectangle);

c、如果变量是Mat类型的获取roi方式为:

            Mat srcimg = capture.QueryFrame();
            Rectangle rect = new Rectangle(roix, roiy, roiw, roih);
            Mat srcroi = new Mat(srcimg, rect);

3、C#进行打开相机跟设置相机roi的方法:

            capture = new Capture(0);
            capture.SetCaptureProperty(CapProp.FrameHeight, 1080);
            capture.SetCaptureProperty(CapProp.FrameWidth, 1920);

4、进行画框的方法:

// 画框
Rectangle faceRegion = rectangles[index];
flipImage.Draw(img, new Bgr(Color.Green), 4);

 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值