Commit 5fb261df authored by Bruce's avatar Bruce

first -v 0.1

parent 4558df7b
...@@ -54,16 +54,16 @@ namespace ETC_App1 ...@@ -54,16 +54,16 @@ namespace ETC_App1
DirectoryInfo dir = new DirectoryInfo(@Imgs_path); DirectoryInfo dir = new DirectoryInfo(@Imgs_path);
foreach (FileInfo dChild in dir.GetFiles("*.jgp")) foreach (FileInfo dChild in dir.GetFiles("*.jgp"))
{ {
this.listBox1.Items.Add(Path.Combine(Imgs_path,dChild.Name)); this.listBox1.Items.Add("=> "+Path.Combine(Imgs_path,dChild.Name));
} }
foreach (FileInfo dChild in dir.GetFiles("*.png")) foreach (FileInfo dChild in dir.GetFiles("*.png"))
{ {
this.listBox1.Items.Add(Path.Combine(Imgs_path,dChild.Name)); this.listBox1.Items.Add("=> " + Path.Combine(Imgs_path,dChild.Name));
} }
if (listBox1.Items.Count > 0) if (listBox1.Items.Count > 0)
{ {
listBox1.SetSelected(0, true); listBox1.SetSelected(0, true);
string img = listBox1.SelectedItem.ToString(); string img = listBox1.SelectedItem.ToString().Remove(0,3);
Bitmap bitmap = new Bitmap(img); Bitmap bitmap = new Bitmap(img);
pictureBox1.Image = bitmap; pictureBox1.Image = bitmap;
} }
...@@ -75,17 +75,18 @@ namespace ETC_App1 ...@@ -75,17 +75,18 @@ namespace ETC_App1
path.ShowDialog(); path.ShowDialog();
Xmls_path = path.SelectedPath; Xmls_path = path.SelectedPath;
XmlLableObject lableObject = new XmlLableObject(); XmlLableObject obj1 = new XmlLableObject("A", "11", "12", "13", "14");
lableObject.Name = "g"; XmlLableObject obj2 = new XmlLableObject("B", "15", "16", "17", "18");
lableObject.X1 = "10"; XmlLableObject obj3 = new XmlLableObject("C", "19", "20", "21", "22");
lableObject.Y1 = "20";
lableObject.X2 = "30";
lableObject.Y2 = "40";
xmlLable.Object.Add(lableObject);
xmlLable.Object.Add(lableObject); xmlLable.Object.Add(obj1);
xmlLable.Object.Add(lableObject); xmlLable.Object.Add(obj2);
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"); xmlLable.Object.Add(obj3);
ProcessCombobox();
CreateXmlTree(@"C:\Users\Bruce\source\repos\e-eye\ETC_App1\bin\Debug\form2_config\Eample.xml", Xmls_path+@"\Eample2.xml");
} }
private void Form2_KeyPress(object sender, KeyPressEventArgs e) private void Form2_KeyPress(object sender, KeyPressEventArgs e)
...@@ -101,10 +102,19 @@ namespace ETC_App1 ...@@ -101,10 +102,19 @@ namespace ETC_App1
{ {
if (listBox1.Items.Count > listBox1.SelectedIndex + 1) if (listBox1.Items.Count > listBox1.SelectedIndex + 1)
{ {
listBox1.SetSelected(listBox1.SelectedIndex + 1, true); listBox1.SetSelected(listBox1.SelectedIndex+1 , true);
string img = listBox1.SelectedItem.ToString(); string img = listBox1.SelectedItem.ToString().Remove(0, 3);
Bitmap bitmap = new Bitmap(img); Bitmap bitmap = new Bitmap(img);
pictureBox1.Image = bitmap; pictureBox1.Image = bitmap;
this.xmlLable = new XmlLable();
checkedListBox1.Items.Clear();
string xml = img.Replace(".jpg", ".xml").Replace(".png",".xml");
if (File.Exists(xml))
{
Console.WriteLine(xml);
}
} }
} }
} }
...@@ -115,9 +125,11 @@ namespace ETC_App1 ...@@ -115,9 +125,11 @@ namespace ETC_App1
if (0 <= listBox1.SelectedIndex -1) if (0 <= listBox1.SelectedIndex -1)
{ {
listBox1.SetSelected(listBox1.SelectedIndex - 1, true); listBox1.SetSelected(listBox1.SelectedIndex - 1, true);
string img = listBox1.SelectedItem.ToString(); string img = listBox1.SelectedItem.ToString().Remove(0, 3);
Bitmap bitmap = new Bitmap(img); Bitmap bitmap = new Bitmap(img);
pictureBox1.Image = bitmap; pictureBox1.Image = bitmap;
this.xmlLable = new XmlLable();
checkedListBox1.Items.Clear();
} }
} }
} }
...@@ -185,5 +197,21 @@ namespace ETC_App1 ...@@ -185,5 +197,21 @@ namespace ETC_App1
} }
doc.Save(save_path); doc.Save(save_path);
} }
public void ProcessCombobox()
{
List<XmlLableObject> objs = xmlLable.Object;
foreach (XmlLableObject obj in objs)
{
string temp = String.Format("{0}: {1},{2},{3},{4}", obj.Name, obj.X1, obj.Y1, obj.X2, obj.Y2);
if (checkedListBox1.Items.IndexOf(temp) < 0 || true)
{
checkedListBox1.Items.Add(temp);
checkedListBox1.SetItemChecked(checkedListBox1.Items.IndexOf(temp), true);
}
}
}
} }
} }
...@@ -8,11 +8,21 @@ namespace ETC_App1 ...@@ -8,11 +8,21 @@ namespace ETC_App1
{ {
class XmlLableObject class XmlLableObject
{ {
public string Name { get; set; } public string Name { get; set; }
public string X1 { get; set; } public string X1 { get; set; }
public string Y1 { get; set; } public string Y1 { get; set; }
public string X2 { get; set; } public string X2 { get; set; }
public string Y2 { get; set; } public string Y2 { get; set; }
public XmlLableObject(string name, string x1, string y1, string x2,string y2)
{
this.Name = name;
this.X1 = x1;
this.X2 = x2;
this.Y1 = y1;
this.Y2 = y2;
}
} }
} }
<annotation> <annotation>
<folder> <folder>ignore</folder>
</folder>
<filename> <filename>
</filename> </filename>
<path> <path>ignore</path>
</path>
<source> <source>
<database>Unknown</database> <database>Unknown</database>
</source> </source>
...@@ -18,39 +16,75 @@ ...@@ -18,39 +16,75 @@
</size> </size>
<segmented>0</segmented> <segmented>0</segmented>
<object> <object>
<name>g</name> <name>A</name>
<pose>Unspecified</pose> <pose>Unspecified</pose>
<truncated>0</truncated> <truncated>0</truncated>
<difficult>0</difficult> <difficult>0</difficult>
<bndbox> <bndbox>
<xmin>10</xmin> <xmin>11</xmin>
<ymin>20</ymin> <ymin>12</ymin>
<xmax>30</xmax> <xmax>13</xmax>
<ymax>40</ymax> <ymax>14</ymax>
</bndbox> </bndbox>
</object> </object>
<object> <object>
<name>g</name> <name>B</name>
<pose>Unspecified</pose> <pose>Unspecified</pose>
<truncated>0</truncated> <truncated>0</truncated>
<difficult>0</difficult> <difficult>0</difficult>
<bndbox> <bndbox>
<xmin>10</xmin> <xmin>15</xmin>
<ymin>16</ymin>
<xmax>17</xmax>
<ymax>18</ymax>
</bndbox>
</object>
<object>
<name>C</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>19</xmin>
<ymin>20</ymin> <ymin>20</ymin>
<xmax>30</xmax> <xmax>21</xmax>
<ymax>40</ymax> <ymax>22</ymax>
</bndbox>
</object>
<object>
<name>A</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>11</xmin>
<ymin>12</ymin>
<xmax>13</xmax>
<ymax>14</ymax>
</bndbox>
</object>
<object>
<name>B</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>15</xmin>
<ymin>16</ymin>
<xmax>17</xmax>
<ymax>18</ymax>
</bndbox> </bndbox>
</object> </object>
<object> <object>
<name>g</name> <name>C</name>
<pose>Unspecified</pose> <pose>Unspecified</pose>
<truncated>0</truncated> <truncated>0</truncated>
<difficult>0</difficult> <difficult>0</difficult>
<bndbox> <bndbox>
<xmin>10</xmin> <xmin>19</xmin>
<ymin>20</ymin> <ymin>20</ymin>
<xmax>30</xmax> <xmax>21</xmax>
<ymax>40</ymax> <ymax>22</ymax>
</bndbox> </bndbox>
</object> </object>
</annotation> </annotation>
\ No newline at end of file
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