⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 Open CV Project for image processing in my College
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using openCV;
namespace tespola
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            IplImage img, gray;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                // Load image from file
                img = cvlib.CvLoadImage(openFileDialog1.FileName, cvlib.CV_LOAD_IMAGE_COLOR);
                // create grey channel image
                gray = cvlib.CvCreateImage(new CvSize(img.width, img.height),
                                (int)cvlib.IPL_DEPTH_8U, 1);
                // color conversion
                cvlib.CvCvtColor(ref img, ref gray, cvlib.CV_BGR2GRAY);
                // apply the operator
                cvlib.CvCanny(ref gray, ref gray, 100, 100, 3);
                // Create external window
                cvlib.CvNamedWindow("MyWindow", cvlib.CV_WINDOW_AUTOSIZE);
                // Show the edge image in external Window
                cvlib.CvShowImage("MyWindow", ref gray);
                // Show the input image in the Picture Box Control
                this.pictureBox1.Image = (Bitmap)img;
            }

            
        }
     
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -