?? form1.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 + -