1. 使用滑鼠點選專案FPGA型號,再按"滑鼠右鍵",選擇"Settings..."。
2. 選擇"General" > "Top-level entity:",再選擇頂層模組程式,按"OK"。
1
2
| #include <cv.h> #include <highgui.h> |
1
2
3
4
5
6
7
8
9
10
11
12
13
| namespace test { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace cv; //add source code CvCapture* capture; //add source code IplImage* frame; //add source code |
1
2
3
4
5
6
7
8
9
10
11
| private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { capture = cvCaptureFromCAM(0); timer1->Start(); } private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) { frame = cvQueryFrame(capture); pictureBox1->Image = gcnew Bitmap(frame->width,frame->height,frame->widthStep, Imaging::PixelFormat::Format24bppRgb,(System::IntPtr) frame->imageData); } |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Emgu.CV; using Emgu.Util; using Emgu.CV.Structure; namespace WindowsFormsApplication5 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { var dialog = new OpenFileDialog(); dialog.Filter = "photo(*.jpg/*.png/*.gif/*.bmp)|*.jpg;*.png;*.gif;*.bmp" ; if (dialog.ShowDialog() == DialogResult.OK) { var filename = dialog.FileName; Image<bgr, byte= "" > My_Image = new Image<bgr, byte= "" >(filename); pictureBox1.BackgroundImage = My_Image.ToBitmap(); Image<gray, byte= "" > grayFrame = My_Image.Convert<gray, byte= "" >(); pictureBox2.BackgroundImage = grayFrame.ToBitmap(); pictureBox3.BackgroundImage = grayFrame.Canny( new Gray(100), new Gray(60)).ToBitmap(); } } } } |