-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.cs
86 lines (73 loc) · 2.72 KB
/
Form1.cs
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using Alturos.Yolo;
using Alturos.Yolo.Model;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DetectObjectApp
{
public partial class NoDetect : Form
{
public NoDetect()
{
InitializeComponent();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void btnOpen_Click(object sender, EventArgs e)
{
// using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "PNG|*.png|JPEG|*.jpeg|JPG|*.jpg"})
// {
// if (ofd.ShowDialog() == DialogResult.OK)
// {
pic.Image = Image.FromFile(@"D:\Visual Studio 2017\Projects\Alturos.Yolo-master\Images\Car1.png");
using (var yoloWrapper = new YoloWrapper("yolov2-tiny-voc.cfg", "yolov2-tiny-voc.weights", "voc.names"))
{
using (MemoryStream ms = new MemoryStream())
{
pic.Image.Save(ms, ImageFormat.Png);
var items = yoloWrapper.Detect(ms.ToArray());
yoloItemBindingSource.DataSource = items;
}
//
//items[0].Type -> "Person, Car, ..."
//items[0].Confidence -> 0.0 (low) -> 1.0 (high)
//items[0].X -> bounding box
//items[0].Y -> bounding box
//items[0].Width -> bounding box
//items[0].Height -> bounding box
}
//}
//}
}
private void btnDetect_Click(object sender, EventArgs e)
{
// var configurationDetector = new ConfigurationDetector();
// var config = configurationDetector.Detect();
// using (var yoloWrapper = new YoloWrapper("yolov2-tiny-voc.cfg", "yolov2-tiny-voc.weights", "voc.names"))
// {
// using (MemoryStream ms = new MemoryStream())
// {
// pic.Image.Save(ms, ImageFormat.Png);
// var items = yoloWrapper.Detect(ms.ToArray());
// yoloItemBindingSource.DataSource = items;
// }
//items[0].Type -> "Person, Car, ..."
//items[0].Confidence -> 0.0 (low) -> 1.0 (high)
//items[0].X -> bounding box
//items[0].Y -> bounding box
//items[0].Width -> bounding box
//items[0].Height -> bounding box
}
//}
}
}