Form1.cs
2.1 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Camera
{
public partial class Form1 : Form
{
private Asa.Camera.VisionLib lib;
private string[] imagePath;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string path = @"C:\Neotel\DLL\Camera\Camera.json";
lib = new Asa.Camera.VisionLib(path);
//lib.SaveImage(@"C:\Users\asa\Downloads", "qq", System.Drawing.Imaging.ImageFormat.Bmp);
//imagePath = System.IO.Directory.GetFiles(@"C:\Users\asa\Downloads\图像比较", "*.png");
//for (int i = 0; i < imagePath.Length; i++)
// listBox1.Items.Add(System.IO.Path.GetFileName(imagePath[i]));
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
lib.Dispose();
}
private void button1_Click(object sender, EventArgs e)
{
//Bitmap bmp1 = new Bitmap(imagePath[listBox1.SelectedIndex]);
//bool rtn1 = lib.FeatureSingleCompare(bmp1, "monitor", "C计划", out Dictionary<string, bool> exist);
//KeyValuePair<string, bool> pair = exist.ElementAt(0);
//label1.Text = pair.Value.ToString();
System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(aaa));
thread.Start();
}
private void aaa()
{
int i= 0;
while (i < 200)
{
using Bitmap bmp1 = new Bitmap(imagePath[0]);
bool rtn1 = lib.FeatureSingleCompare(bmp1, "monitor", "C计划", out Dictionary<string, bool> exist);
KeyValuePair<string, bool> pair = exist.ElementAt(0);
Console.WriteLine(i.ToString() + " " + pair.Value.ToString());
System.Threading.Thread.Sleep(100);
i++;
}
}
}
}