Commit 4558df7b authored by Bruce's avatar Bruce

first version

parent 41cd7bbc
......@@ -153,6 +153,12 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Form2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form2.Designer.cs">
<DependentUpon>Form2.cs</DependentUpon>
</Compile>
<Compile Include="HyperLPR.cs" />
<Compile Include="Json.cs" />
<Compile Include="JsonPlate.cs" />
......@@ -167,6 +173,9 @@
</Compile>
<Compile Include="ROI.cs" />
<Compile Include="Server.cs" />
<Compile Include="XmlLable.cs" />
<Compile Include="XmlLableSize.cs" />
<Compile Include="XmlLableObject.cs" />
<EmbeddedResource Include="ETCBackgroundWorker1.resx">
<DependentUpon>ETCBackgroundWorker1.cs</DependentUpon>
</EmbeddedResource>
......@@ -191,6 +200,9 @@
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form2.resx">
<DependentUpon>Form2.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......
......@@ -23,6 +23,14 @@ namespace ETC_App1
public Form1()
{
InitializeComponent();
Button button1 = new Button();
button1.DialogResult = DialogResult.Yes;
button1.Location = new System.Drawing.Point(500, 500);
button1.Text = "test";
button1.Size = new System.Drawing.Size(80, 50);
button1.Click += button1_Click;
Controls.Add(button1);
}
private int ToolStripWidth
......@@ -516,6 +524,22 @@ namespace ETC_App1
file2003.Close();
workbook2003.Close();
}
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
Form2 form2 = new Form2();
switch (form2.ShowDialog(this))
{
case DialogResult.Yes:
this.Show();
break;
case DialogResult.No:
this.Close();
break;
default:
break;
}
}
}
}
This diff is collapsed.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
namespace ETC_App1
{
public partial class Form2 : Form
{
private string Imgs_path = "";
private string Xmls_path = "";
private XmlLable xmlLable = new XmlLable();
public Form2()
{
InitializeComponent();
}
bool IsToForm1 = false;
private void button9_Click(object sender, EventArgs e)
{
IsToForm1 = true;
this.Close();
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
if (IsToForm1)
{
this.DialogResult = DialogResult.Yes;
}
else
{
this.DialogResult = DialogResult.No;
}
}
private void img_path_btn_Click(object sender, EventArgs e)
{
FolderBrowserDialog path = new FolderBrowserDialog();
path.ShowDialog();
Imgs_path=path.SelectedPath;
if (!string.IsNullOrEmpty(Imgs_path)) {
DirectoryInfo dir = new DirectoryInfo(@Imgs_path);
foreach (FileInfo dChild in dir.GetFiles("*.jgp"))
{
this.listBox1.Items.Add(Path.Combine(Imgs_path,dChild.Name));
}
foreach (FileInfo dChild in dir.GetFiles("*.png"))
{
this.listBox1.Items.Add(Path.Combine(Imgs_path,dChild.Name));
}
if (listBox1.Items.Count > 0)
{
listBox1.SetSelected(0, true);
string img = listBox1.SelectedItem.ToString();
Bitmap bitmap = new Bitmap(img);
pictureBox1.Image = bitmap;
}
}
}
private void xml_path_btn_Click(object sender, EventArgs e)
{
FolderBrowserDialog path = new FolderBrowserDialog();
path.ShowDialog();
Xmls_path = path.SelectedPath;
XmlLableObject lableObject = new XmlLableObject();
lableObject.Name = "g";
lableObject.X1 = "10";
lableObject.Y1 = "20";
lableObject.X2 = "30";
lableObject.Y2 = "40";
xmlLable.Object.Add(lableObject);
xmlLable.Object.Add(lableObject);
xmlLable.Object.Add(lableObject);
CreateXmlTree(@"C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\form2_config\Eample.xml", @"C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\form2_config\Eample2.xml");
}
private void Form2_KeyPress(object sender, KeyPressEventArgs e)
{
}
private void Form2_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.D) //下一張按鈕
{
if (listBox1.Items.Count>0)
{
if (listBox1.Items.Count > listBox1.SelectedIndex + 1)
{
listBox1.SetSelected(listBox1.SelectedIndex + 1, true);
string img = listBox1.SelectedItem.ToString();
Bitmap bitmap = new Bitmap(img);
pictureBox1.Image = bitmap;
}
}
}
if (e.KeyCode == Keys.A) //上一張按鈕
{
if (listBox1.Items.Count > 0)
{
if (0 <= listBox1.SelectedIndex -1)
{
listBox1.SetSelected(listBox1.SelectedIndex - 1, true);
string img = listBox1.SelectedItem.ToString();
Bitmap bitmap = new Bitmap(img);
pictureBox1.Image = bitmap;
}
}
}
if (e.Control && e.KeyCode == Keys.S) //儲存按鈕
{
}
if (e.Control && e.KeyCode == Keys.W) //創建區塊 按鈕
{
}
if (e.Control && e.KeyCode == Keys.E) //儲存按鈕
{
}
}
public void CreateXmlTree(string src_path,string save_path)
{
XmlDocument doc = new XmlDocument();
doc.Load(src_path);
List<XmlLableObject>obj = xmlLable.Object;
XmlNode newobj;
for (int i = 0; i < obj.Count; i++)
{
if (i != 0)
{
newobj = doc.ImportNode(doc.DocumentElement.SelectSingleNode("object"), true);
doc.DocumentElement.AppendChild(newobj);
}
else
newobj = doc.DocumentElement.SelectSingleNode("object");
XmlNode name_node = newobj.SelectSingleNode("name");
if (name_node.LastChild == null)
name_node.AppendChild(doc.CreateTextNode(obj[i].Name));
else
name_node.ReplaceChild(doc.CreateTextNode(obj[i].Name), name_node.LastChild);// 修改節點
XmlNode x1_node = newobj.SelectSingleNode("bndbox").SelectSingleNode("xmin");
if (x1_node.LastChild == null)
x1_node.AppendChild(doc.CreateTextNode(obj[i].X1));
else
x1_node.ReplaceChild(doc.CreateTextNode(obj[i].X1), x1_node.LastChild);// 修改節點
XmlNode y1_node = newobj.SelectSingleNode("bndbox").SelectSingleNode("ymin");
if(y1_node.LastChild==null)
y1_node.AppendChild(doc.CreateTextNode(obj[i].Y1));
else
y1_node.ReplaceChild(doc.CreateTextNode(obj[i].Y1), y1_node.LastChild);// 修改節點
XmlNode x2_node = newobj.SelectSingleNode("bndbox").SelectSingleNode("xmax");
if (x2_node.LastChild == null)
x2_node.AppendChild(doc.CreateTextNode(obj[i].X2));
else
x2_node.ReplaceChild(doc.CreateTextNode(obj[i].X2), x2_node.LastChild);// 修改節點
XmlNode y2_node = newobj.SelectSingleNode("bndbox").SelectSingleNode("ymax");
if(y2_node.LastChild == null)
y2_node.AppendChild(doc.CreateTextNode(obj[i].Y2));
else
y2_node.ReplaceChild(doc.CreateTextNode(obj[i].Y2), y2_node.LastChild);// 修改節點
}
doc.Save(save_path);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>195, 17</value>
</metadata>
</root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ETC_App1
{
class XmlLable
{
public string Filename { get; set; }
public XmlLableSize Size = new XmlLableSize();
public List<XmlLableObject> Object = new List<XmlLableObject>();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ETC_App1
{
class XmlLableObject
{
public string Name { get; set; }
public string X1 { get; set; }
public string Y1 { get; set; }
public string X2 { get; set; }
public string Y2 { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ETC_App1
{
class XmlLableSize
{
public string Height { get; set; }
public string Width { get; set; }
public string Depth { get; set; }
}
}
<annotation>
<folder>ignore</folder>
<filename></filename>
<path>ignore</path>
<source>
<database>Unknown</database>
</source>
<size>
<width></width>
<height></height>
<depth></depth>
</size>
<segmented>0</segmented>
<object>
<name></name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin></xmin>
<ymin></ymin>
<xmax></xmax>
<ymax></ymax>
</bndbox>
</object>
</annotation>
\ No newline at end of file
<annotation>
<folder>
</folder>
<filename>
</filename>
<path>
</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>
</width>
<height>
</height>
<depth>
</depth>
</size>
<segmented>0</segmented>
<object>
<name>g</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>10</xmin>
<ymin>20</ymin>
<xmax>30</xmax>
<ymax>40</ymax>
</bndbox>
</object>
<object>
<name>g</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>10</xmin>
<ymin>20</ymin>
<xmax>30</xmax>
<ymax>40</ymax>
</bndbox>
</object>
<object>
<name>g</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>10</xmin>
<ymin>20</ymin>
<xmax>30</xmax>
<ymax>40</ymax>
</bndbox>
</object>
</annotation>
\ No newline at end of file
......@@ -361,3 +361,65 @@ C:\Users\ECOM\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.csproj.CoreCompileI
C:\Users\ECOM\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.csproj.CopyComplete
C:\Users\ECOM\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.exe
C:\Users\ECOM\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.pdb
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\x64\concrt140.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\x64\cvextern.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\x64\msvcp140.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\x64\opencv_ffmpeg401_64.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\x64\vcruntime140.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\x86\concrt140.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\x86\cvextern.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\x86\msvcp140.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\x86\opencv_ffmpeg401.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\x86\vcruntime140.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\ETC_App1.exe.config
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\ETC_App1.exe
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\ETC_App1.pdb
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\Aspose.BarCode.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\DuoVia.FuzzyStrings.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\Emgu.CV.UI.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\Emgu.CV.World.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\ICSharpCode.SharpZipLib.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\MySql.Data.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\Newtonsoft.Json.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\NPOI.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\NPOI.OOXML.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\NPOI.OpenXml4Net.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\NPOI.OpenXmlFormats.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\RestSharp.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\ZedGraph.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\Aspose.BarCode.xml
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\Emgu.CV.UI.xml
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\Emgu.CV.World.xml
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\ICSharpCode.SharpZipLib.xml
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\MySql.Data.xml
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\Newtonsoft.Json.xml
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\RestSharp.xml
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\ZedGraph.xml
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\de\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\es\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\fr\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\hu\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\it\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\ja\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\pt\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\ru\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\sk\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\sv\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\tr\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\zh-cn\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\zh-tw\ZedGraph.resources.dll
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.csprojAssemblyReference.cache
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCBackgroundWorker1.resources
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCBackgroundWorker2.resources
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCBackgroundWorker3.resources
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCPictureBox.resources
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCPictureCheckBox.resources
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCStatusStrip.resources
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCToolStrip.resources
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.Form1.resources
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.Properties.Resources.resources
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.csproj.GenerateResource.cache
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.csproj.CopyComplete
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.exe
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.pdb
C:\Users\Bruce\source\repos\e-eye\ETC_App1\obj\Debug\ETC_App1.Form2.resources
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment