EmguCV 输出图片尺寸

新建windows form解决方案
下载emgucv引用程序包
在工具箱处拖一个imagebox用来显示图片
form1窗口程序加一个窗口Load动作

using System;

using Emgu.CV;
using Emgu.CV.Structure;
using System.IO;

using System.Windows.Forms;

namespace Output_Image_Size
{
    public partial class Form1 : Form
    {
        public static string Image_path;
        public static Image<Bgr, Byte> src;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string root_path = Directory.GetCurrentDirectory(); //获取根地址
            Image_path = Path.Combine(root_path, "src.png");//合成图片源地址
            src = new Image<Bgr, Byte>(Image_path);//装载图片
            Console.WriteLine(Image_path);//输出图片地址
            Console.WriteLine("Width is " + src.Width + " ;Heigth is " + src.Height);
            imageBox1.Image = src;//显示出图片
        }
    }
}

猜你喜欢

转载自blog.csdn.net/zhelijun/article/details/88390793