Commit ece74f1c authored by Bruce's avatar Bruce

version 1.1

parent 57963494
......@@ -10,10 +10,12 @@ namespace ETC_App1
{
public class BndBox : Panel
{
int dotSize = 10; //需要被 2 整除
int dotSize = 6; //需要被 2 整除
List <Color> colors=new List<Color> { Color.Red,Color.Orange,Color.Yellow,Color.Green,Color.Blue,Color.Brown,Color.Purple};
int Color_ind;
public int Num;
public int black_left_width;
public int black_top_height;
public BndBox(Point location, Size size , int color)
{
InitializeComponent();
......@@ -66,58 +68,119 @@ namespace ETC_App1
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
if (MouseDownLocation.X <= dotSize && MouseDownLocation.Y <= dotSize && this.Width >= dotSize * 3 && this.Height >= dotSize * 3) //左上點
PictureBox perent = this.Parent as PictureBox;
if (MouseDownLocation.X <= dotSize && MouseDownLocation.Y <= dotSize) //左上點
{
this.Left += e.X - MouseDownLocation.X;
if (this.Top + e.Y - MouseDownLocation.Y - black_top_height > 0)
{
this.Height -= e.Y - MouseDownLocation.Y;
this.Top += e.Y - MouseDownLocation.Y;
}
else
this.Top = 0+black_top_height;
if (this.Left + e.X - MouseDownLocation.X > 0)
{
this.Left += e.X - MouseDownLocation.X;
this.Width -= e.X - MouseDownLocation.X;
this.Height -= e.Y - MouseDownLocation.Y;
}
else if (MouseDownLocation.X <= dotSize && MouseDownLocation.Y >= this.Height - dotSize && this.Width >= dotSize * 3 && this.Height >= dotSize * 3) //左下點
else
this.Left = 0;
if(this.Width < dotSize * 3)
this.Width += dotSize;
if (this.Height < dotSize * 3)
this.Height += dotSize;
}
else if (MouseDownLocation.X <= dotSize && MouseDownLocation.Y >= this.Height - dotSize) //左下點
{
if (this.Left + e.X - MouseDownLocation.X > 0)
{
this.Left += e.X - MouseDownLocation.X;
this.Width -= e.X - MouseDownLocation.X;
}
else
this.Left = 0;
if (this.Top + this.Height + e.Y - MouseDownLocation.Y <= perent.Height - black_top_height)
{
this.Height += e.Y - MouseDownLocation.Y;
MouseDownLocation.Y = e.Y;
}
else
this.Height = perent.Height - black_top_height - this.Top;
if (this.Width < dotSize * 3)
this.Width += dotSize;
if (this.Height < dotSize * 3)
this.Height += dotSize;
}
else if (MouseDownLocation.X >= this.Width - dotSize && MouseDownLocation.Y <= dotSize && this.Width >= dotSize * 3 && this.Height >= dotSize * 3) //右上點
else if (MouseDownLocation.X >= this.Width - dotSize && MouseDownLocation.Y <= dotSize) //右上點
{
if (this.Left + this.Width + e.X - MouseDownLocation.X <= perent.Width)
{
this.Top += e.Y - MouseDownLocation.Y;
this.Width += e.X - MouseDownLocation.X;
MouseDownLocation.X = e.X;
}
else
this.Width = perent.Width - this.Left;
if (this.Top + e.Y - MouseDownLocation.Y > black_top_height)
{
this.Top += e.Y - MouseDownLocation.Y;
this.Height -= e.Y - MouseDownLocation.Y;
}
else
this.Top = 0+black_top_height;
if (this.Width < dotSize * 3)
this.Width += dotSize;
if (this.Height < dotSize * 3)
this.Height += dotSize;
MouseDownLocation.X = e.X;
}
else if (MouseDownLocation.X >= this.Width - dotSize && MouseDownLocation.Y >= this.Height - dotSize && this.Width >= dotSize * 3 && this.Height >= dotSize * 3) //右下點
{
if (this.Left + this.Width + e.X - MouseDownLocation.X <= perent.Width)
{
this.Width += e.X - MouseDownLocation.X;
this.Height += e.Y - MouseDownLocation.Y;
MouseDownLocation.X = e.X;
MouseDownLocation.Y = e.Y;
this.Left += 1;
this.Left -= 1;
}
else if (this.Width >= dotSize * 3 && this.Height >= dotSize * 3)
else
this.Width = perent.Width - this.Left;
if (this.Top + this.Height + e.Y - MouseDownLocation.Y <= perent.Height - black_top_height)
{
this.Left = e.X + this.Left - MouseDownLocation.X;
this.Top = e.Y + this.Top - MouseDownLocation.Y;
this.Height += e.Y - MouseDownLocation.Y;
MouseDownLocation.Y = e.Y;
}
else
{
this.Width += 1;
this.Height += 1;
this.Height = perent.Height - black_top_height - this.Top;
if (this.Width < dotSize * 3)
this.Width += dotSize;
if (this.Height < dotSize * 3)
this.Height += dotSize;
}
if (this.Top < 0)
this.Top = 0;
if (this.Left < 0)
else //移動
{
if (e.X + this.Left - MouseDownLocation.X < 0)
this.Left = 0;
PictureBox perent = this.Parent as PictureBox;
if (perent.Height < this.Top + this.Height)
this.Top = perent.Height - this.Height;
if (perent.Width < this.Left + this.Width)
this.Left = perent.Width - this.Width;
else if (e.X + this.Left + this.Width - MouseDownLocation.X <= perent.Width)
this.Left = e.X + this.Left - MouseDownLocation.X;
if (e.Y + this.Top - MouseDownLocation.Y < black_top_height)
this.Top = black_top_height;
else if (e.Y + this.Top+this.Height - MouseDownLocation.Y<=perent.Height-black_top_height)
this.Top = e.Y + this.Top - MouseDownLocation.Y;
}
//防止破圖
this.Left += 1;
this.Left -= 1;
this.Top += 1;
this.Top -= 1;
}
}
......@@ -140,5 +203,6 @@ namespace ETC_App1
{
this.BringToFront();
}
}
}
......@@ -174,21 +174,21 @@ namespace ETC_App1
break;
}
else if (fuzzy > 0.1)
{
// 辨識成功,比對錯誤
json.message1 = data[i]["車牌號碼"];
//else if (fuzzy > 0.1)
//{
// // 辨識成功,比對錯誤
// json.message1 = data[i]["車牌號碼"];
json.success = true;
// json.success = true;
json.failed = true;
// json.failed = true;
json.tickoff = false;
// json.tickoff = false;
break;
// break;
//json.message2 = (json.message2 == null ? "資料異常" : json.message2) + "[" + result + "]";
}
// //json.message2 = (json.message2 == null ? "資料異常" : json.message2) + "[" + result + "]";
//}
else
{
json.success = false;
......@@ -197,13 +197,13 @@ namespace ETC_App1
json.lost1 = false;
json.lost2 = false;
json.message1 = data[i]["車牌號碼"];
json.message2 = "車牌定位無結果";
json.message2 = result;
}
}
else { json.message2 = "車牌辨識無結果"; }
else { json.message2 = "車牌定位無結果"; }
}
}
else { json.message2 = "車牌辨識無結果"; }
else { json.message2 = "車牌定位無結果"; }
}
}
else {
......
......@@ -141,7 +141,9 @@ namespace ETC_App1
listBox1.Items.Add((json.lost2 ? "" : json.index + ". ") + (json.tickoff ? (json.content&&json.failed?json.message2:"資料異常"):json.message1 ));
listBox2.Items.Add((json.lost2 ? json.filename + "," : json.index + ". ") + (json.tickoff?(json.content?(json.failed?json.message1:json.message2):json.filename):json.message1));
//listBox2.Items.Add((json.lost2 ? json.filename + "," : json.index + ". ") + (json.tickoff?(json.content?(json.failed?json.message1:json.message2):json.filename):json.message1));
listBox2.Items.Add(string.Format("{0},{1}", json.message1, json.message2));
listBox2.SelectedIndex = listBox2.Items.Count - 1;
}
......
......@@ -244,7 +244,7 @@ namespace ETC_App1
}
private void EtcBackgroundWorker31_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
if (e.UserState is Json && (e.UserState as Json).success)
if (e.UserState is Json/* && (e.UserState as Json).success*/)
{
etcPictureCheckBox1.Add(e.UserState as Json);
}
......
......@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form2));
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
......@@ -173,14 +174,14 @@
this.label6.Font = new System.Drawing.Font("標楷體", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
this.label6.Location = new System.Drawing.Point(3, 763);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(165, 22);
this.label6.Size = new System.Drawing.Size(165, 43);
this.label6.TabIndex = 21;
this.label6.Text = "儲存( Ctl+S )";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button1
//
this.button1.BackgroundImage = global::ETC_App1.Properties.Resources.floppy_disk;
this.button1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button1.BackgroundImage")));
this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.button1.Cursor = System.Windows.Forms.Cursors.Hand;
this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -201,7 +202,7 @@
this.label3.Font = new System.Drawing.Font("標楷體", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
this.label3.Location = new System.Drawing.Point(3, 649);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(165, 22);
this.label3.Size = new System.Drawing.Size(165, 35);
this.label3.TabIndex = 19;
this.label3.Text = "存放標籤目錄";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
......@@ -209,7 +210,7 @@
//
// xml_path_btn
//
this.xml_path_btn.BackgroundImage = global::ETC_App1.Properties.Resources.xml_file_format_symbol;
this.xml_path_btn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("xml_path_btn.BackgroundImage")));
this.xml_path_btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.xml_path_btn.Cursor = System.Windows.Forms.Cursors.Hand;
this.xml_path_btn.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -229,7 +230,7 @@
this.label2.Font = new System.Drawing.Font("標楷體", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
this.label2.Location = new System.Drawing.Point(3, 535);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(165, 22);
this.label2.Size = new System.Drawing.Size(165, 35);
this.label2.TabIndex = 17;
this.label2.Text = "開啟圖片目錄";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
......@@ -238,7 +239,7 @@
// img_path_btn
//
this.img_path_btn.BackColor = System.Drawing.Color.White;
this.img_path_btn.BackgroundImage = global::ETC_App1.Properties.Resources.files_and_folders;
this.img_path_btn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("img_path_btn.BackgroundImage")));
this.img_path_btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.img_path_btn.Cursor = System.Windows.Forms.Cursors.Hand;
this.img_path_btn.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -266,7 +267,7 @@
//
// button7
//
this.button7.BackgroundImage = global::ETC_App1.Properties.Resources.image__1_;
this.button7.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button7.BackgroundImage")));
this.button7.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.button7.Cursor = System.Windows.Forms.Cursors.Hand;
this.button7.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -294,7 +295,7 @@
//
// button6
//
this.button6.BackgroundImage = global::ETC_App1.Properties.Resources.image;
this.button6.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button6.BackgroundImage")));
this.button6.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.button6.Cursor = System.Windows.Forms.Cursors.Hand;
this.button6.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -315,14 +316,14 @@
this.label5.Font = new System.Drawing.Font("標楷體", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
this.label5.Location = new System.Drawing.Point(3, 193);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(165, 22);
this.label5.Size = new System.Drawing.Size(165, 35);
this.label5.TabIndex = 9;
this.label5.Text = "上一張 ( A )";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button4
//
this.button4.BackgroundImage = global::ETC_App1.Properties.Resources.left;
this.button4.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button4.BackgroundImage")));
this.button4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.button4.Cursor = System.Windows.Forms.Cursors.Hand;
this.button4.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -343,14 +344,14 @@
this.label4.Font = new System.Drawing.Font("標楷體", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
this.label4.Location = new System.Drawing.Point(3, 79);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(165, 22);
this.label4.Size = new System.Drawing.Size(165, 35);
this.label4.TabIndex = 7;
this.label4.Text = "下一張 ( D )";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button3
//
this.button3.BackgroundImage = global::ETC_App1.Properties.Resources.right;
this.button3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button3.BackgroundImage")));
this.button3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.button3.Cursor = System.Windows.Forms.Cursors.Hand;
this.button3.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -402,7 +403,7 @@
this.textBox1.Font = new System.Drawing.Font("新細明體", 12F);
this.textBox1.Location = new System.Drawing.Point(125, 64);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 27);
this.textBox1.Size = new System.Drawing.Size(100, 36);
this.textBox1.TabIndex = 9;
this.textBox1.Text = "plate";
//
......@@ -412,7 +413,7 @@
this.checkBox1.Font = new System.Drawing.Font("新細明體", 12F);
this.checkBox1.Location = new System.Drawing.Point(3, 69);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(123, 20);
this.checkBox1.Size = new System.Drawing.Size(180, 28);
this.checkBox1.TabIndex = 8;
this.checkBox1.Text = "使用預設標籤";
this.checkBox1.UseVisualStyleBackColor = true;
......@@ -435,7 +436,7 @@
this.label9.Font = new System.Drawing.Font("新細明體", 16F);
this.label9.Location = new System.Drawing.Point(3, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(120, 22);
this.label9.Size = new System.Drawing.Size(175, 32);
this.label9.TabIndex = 1;
this.label9.Text = "區塊的標籤";
//
......@@ -457,7 +458,7 @@
this.label10.Font = new System.Drawing.Font("新細明體", 16F);
this.label10.Location = new System.Drawing.Point(0, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(98, 22);
this.label10.Size = new System.Drawing.Size(143, 32);
this.label10.TabIndex = 6;
this.label10.Text = "檔案清單";
//
......@@ -465,7 +466,7 @@
//
this.listBox1.Font = new System.Drawing.Font("新細明體", 12F);
this.listBox1.FormattingEnabled = true;
this.listBox1.ItemHeight = 16;
this.listBox1.ItemHeight = 24;
this.listBox1.Location = new System.Drawing.Point(0, 39);
this.listBox1.Name = "listBox1";
this.listBox1.ScrollAlwaysVisible = true;
......@@ -479,7 +480,7 @@
this.checkedListBox1.FormattingEnabled = true;
this.checkedListBox1.Location = new System.Drawing.Point(3, 164);
this.checkedListBox1.Name = "checkedListBox1";
this.checkedListBox1.Size = new System.Drawing.Size(225, 179);
this.checkedListBox1.Size = new System.Drawing.Size(225, 156);
this.checkedListBox1.TabIndex = 6;
this.checkedListBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.Box_MouseClick);
this.checkedListBox1.DoubleClick += new System.EventHandler(this.checkedListBox1_DoubleClick);
......@@ -531,7 +532,7 @@
//
// button9
//
this.button9.Location = new System.Drawing.Point(153, 4);
this.button9.Location = new System.Drawing.Point(223, 3);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(89, 23);
this.button9.TabIndex = 3;
......@@ -547,7 +548,7 @@
this.label1.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(147, 27);
this.label1.Size = new System.Drawing.Size(217, 40);
this.label1.TabIndex = 2;
this.label1.Text = "上選單區域";
//
......@@ -558,11 +559,12 @@
this.ClientSize = new System.Drawing.Size(963, 859);
this.Controls.Add(this.tableLayoutPanel1);
this.KeyPreview = true;
this.MinimumSize = new System.Drawing.Size(20, 585);
this.MinimumSize = new System.Drawing.Size(22, 585);
this.Name = "Form2";
this.Text = "上傳訓練樣本";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form2_FormClosing);
this.Load += new System.EventHandler(this.Form2_Load);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form2_KeyDown);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
......@@ -599,8 +601,6 @@
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.CheckedListBox checkedListBox1;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Label label1;
......@@ -620,5 +620,7 @@
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.PictureBox pictureBox1;
}
}
\ No newline at end of file
......@@ -34,6 +34,7 @@ namespace ETC_App1
{
//
InitializeComponent();
//this.panel5.MouseWheel += new MouseEventHandler(this.pictureBox1_MouseWheel);
Now_Root = Default_path[0]; // 0 => MTCNN
Imgs_path = Samples_path;
Xmls_path = Path.Combine(Now_Root,"Annotation");
......@@ -61,10 +62,10 @@ namespace ETC_App1
{
this.listBox1.Items.Add("=> " + Path.Combine(Imgs_path, dChild.Name));
}
if (listBox1.Items.Count > 0)
{
listBox1.SelectedIndex = 0;
}
//if (listBox1.Items.Count > 0)
//{
// listBox1.SelectedIndex = 0;
//}
}
}
......@@ -133,7 +134,7 @@ namespace ETC_App1
int currentWidth = rectangle.Width;
int currentHeight = rectangle.Height;
// 418 -> 615
rate = (double)currentHeight / (double)originalHeight;
black_left_width = (currentWidth == this.pictureBox1.Width) ? 0 : (this.pictureBox1.Width - currentWidth) / 2;
......@@ -141,9 +142,9 @@ namespace ETC_App1
try
{
JsonPlateROI roi = Rois[listBox1.SelectedIndex];
if (roi != null)
if (listBox1.SelectedIndex < Rois.Length)
{
JsonPlateROI roi = Rois[listBox1.SelectedIndex];
Bitmap bitmap = new Bitmap(ms);
Rectangle rect = new Rectangle(roi.x, roi.y, roi.w, roi.h);
pictureBox2.Image = bitmap.Clone(rect, bitmap.PixelFormat);
......@@ -155,7 +156,7 @@ namespace ETC_App1
pictureBox2.Image = bitmap.Clone(rect, bitmap.PixelFormat);
}
}
catch
catch (Exception ex)
{
}
......@@ -168,7 +169,8 @@ namespace ETC_App1
this.bndBoxes = new List<BndBox>();
checkedListBox1.Items.Clear();
if (Plates.Length > 0)
{
string xml = Path.GetFileName(img);
xmlLable.Filename = xml;
xmlLable.Plate = Plates[listBox1.SelectedIndex];
......@@ -189,6 +191,7 @@ namespace ETC_App1
}
}
}
}
private void Form2_KeyDown(object sender, KeyEventArgs e)
{
if (listBox1.Items.Count <= 0)
......@@ -360,11 +363,12 @@ namespace ETC_App1
y2_node.ReplaceChild(doc.CreateTextNode(obj[i].Y2), y2_node.LastChild);// 修改節點
}
doc.Save(save_path);
pictureBox1.Image.Save(Path.Combine(Now_Root, "JPEGs", xmlLable.Filename));
if (UploadToAPI(save_path))
return true;
else
return false;
//pictureBox1.Image.Save(Path.Combine(Now_Root, "JPEGs", xmlLable.Filename));
}
private void ReadEixistTree(string src_path)
......@@ -409,13 +413,31 @@ namespace ETC_App1
}
}
public void newBndbox(int move = -1, string name = "A", int x=301 ,int y=159,int w=209 ,int h=138)
public void newBndbox(int move = -1, string name = "A", int x=0 ,int y=0,int w=50 ,int h=50)
{
if (x == 0 && y == 0)
{
w = (int)(pictureBox1.Width / rate);
h = (int)((pictureBox1.Height - (black_top_height * 2)) / rate);
if (Now_Root == Default_path[1]) // 0 => MTCNN 1 => RNN
{
w = (int)(w / 6);
h = (int)(h / 8 * 7);
}
else
{
x = (int)(w / 3);
y = (int)(h /3);
w = (int)(w / 8);
h = (int)(h / 8 );
}
}
if (move >= 0)
move = xmlLable.Object.Count - 1 >= 0 ? xmlLable.Object.Count : 0;
else
move = 0;
int mapping_x=(int)Math.Round(((x+move*5) * rate) + black_left_width, 0, MidpointRounding.AwayFromZero);
x += move*5;
int mapping_x=(int)Math.Round((x * rate) + black_left_width, 0, MidpointRounding.AwayFromZero);
int mapping_y = (int)Math.Round((y * rate) + black_top_height, 0, MidpointRounding.AwayFromZero);
int mapping_w = (int)Math.Round((w * rate) , 0, MidpointRounding.AwayFromZero);
int mapping_h= (int)Math.Round((h * rate), 0, MidpointRounding.AwayFromZero);
......@@ -424,7 +446,7 @@ namespace ETC_App1
BndBox box = new BndBox(pp, ss, xmlLable.Object.Count-1 >=0 ? xmlLable.Object.Count : 0);
if (box.Right > pictureBox1.Width)
{
box.Left = pictureBox1.Width - box.Width;
box.Left = 0;
box.Top += move;
}
box.Paint += Bndbox_GotFocus;
......@@ -434,7 +456,8 @@ namespace ETC_App1
box.Parent = pictureBox1;
bndBoxes.Add(box);
box.BringToFront();
box.black_left_width = black_left_width;
box.black_top_height = black_top_height;
string x1 = Math.Round((box.Left - black_left_width) / rate, 0, MidpointRounding.AwayFromZero).ToString();
string y1 = Math.Round((box.Top - black_top_height) / rate, 0, MidpointRounding.AwayFromZero).ToString();
string x2 = Math.Round((box.Left - black_left_width + box.Width) / rate, 0, MidpointRounding.AwayFromZero).ToString();
......@@ -472,6 +495,7 @@ namespace ETC_App1
string y1 = Math.Round((box.Top - black_top_height) / rate, 0, MidpointRounding.AwayFromZero).ToString();
string x2 = Math.Round((box.Left - black_left_width + box.Width) / rate, 0, MidpointRounding.AwayFromZero).ToString();
string y2 = Math.Round((box.Top - black_top_height + box.Height) / rate, 0, MidpointRounding.AwayFromZero).ToString();
xmlLable.Object[box.Num].modifie(x1, y1, x2, y2);
ProcessCombobox(box.Num);
}
......@@ -590,9 +614,10 @@ namespace ETC_App1
ms.Flush();
fs.Close();
JsonPlateROI roi = Rois[listBox1.SelectedIndex];
if (roi != null)
if (listBox1.SelectedIndex < Rois.Length)
{
JsonPlateROI roi = Rois[listBox1.SelectedIndex];
Bitmap bitmap = new Bitmap(ms);
Rectangle rect = new Rectangle(roi.x, roi.y, roi.w, roi.h);
pictureBox1.Image = bitmap.Clone(rect, bitmap.PixelFormat);
......@@ -628,6 +653,7 @@ namespace ETC_App1
if (index >= 0)
{
string img = listBox1.Items[index].ToString().Remove(0, 3);
img= Path.Combine(Now_Root, "JPEGs",Path.GetFileName(img));
Json json = upl.Process(img, xml, xmlLable.Filename.Replace(".jpg","").Replace(".png",""));
if (!String.IsNullOrEmpty(json.message) && (json.message.Equals("MTCNN sample uploaded !!") || json.message.Equals("RNN sample uploaded !!")))
......@@ -686,5 +712,76 @@ namespace ETC_App1
{
AutoSave();
}
//// 滾輪縮放
//private void pictureBox1_MouseEnter(object sender, EventArgs e)//當鼠標移到pictuBox內,獲取焦點
//{
// panel5.Focus();
//}
//void SetCenterScreen(Control control)
//{
// int screenWidth = Screen.PrimaryScreen.WorkingArea.Width;
// int screenHeight = Screen.PrimaryScreen.WorkingArea.Height;
// int targetLocationLeft;
// int targetLocationTop;
// targetLocationLeft = (screenWidth - control.Width) / 2;
// targetLocationTop = (screenHeight - control.Height) / 2;
// if (control.Parent != null)
// control.Location = control.Parent.PointToClient(new Point(targetLocationLeft, targetLocationTop));
// else
// control.Location = new Point(targetLocationLeft, targetLocationTop);
//}
//private void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
//{
// pictureBox1.SuspendLayout();
// if (e.Delta > 0)
// {
// //int central_x = (int)(pictureBox1.Width / 2);
// //int central_y= (int)(pictureBox1.Height / 2);
// //pictureBox1.Left = (int)((pictureBox1.Left -(e.X-central_x)) * 0.1);
// //pictureBox1.Top = (int)((pictureBox1.Top - (e.Y - central_y)) * 0.1);
// Console.WriteLine(string.Format("{0},{1},{2}", e.X, e.Y, pictureBox1.Location));
// //pictureBox1.Scale(new SizeF { Width = 1.1f, Height = 1.1f });
// pictureBox1.Left = e.X;
// pictureBox1.Top = e.Y-black_top_height;
// Console.WriteLine(string.Format("{0},{1}", black_left_width, black_top_height));
// }
// else
// {
// pictureBox1.Scale(new SizeF { Width = 0.9f, Height = 0.9f });
// pictureBox1.Left = (int)(pictureBox1.Left * 1.1);
// pictureBox1.Top = (int)(pictureBox1.Top * 1.1);
// }
// pictureBox1.ResumeLayout();
// int originalWidth = this.pictureBox1.Image.Width;
// int originalHeight = this.pictureBox1.Image.Height;
// PropertyInfo rectangleProperty = this.pictureBox1.GetType().GetProperty("ImageRectangle", BindingFlags.Instance | BindingFlags.NonPublic);
// Rectangle rectangle = (Rectangle)rectangleProperty.GetValue(this.pictureBox1, null);
// int currentWidth = rectangle.Width;
// int currentHeight = rectangle.Height;
// rate = (double)currentHeight / (double)originalHeight;
// black_left_width = (currentWidth == this.pictureBox1.Width) ? 0 : (this.pictureBox1.Width - currentWidth) / 2;
// black_top_height = (currentHeight == this.pictureBox1.Height) ? 0 : (this.pictureBox1.Height - currentHeight) / 2;
//}
private void Form2_Load(object sender, EventArgs e)
{
if (listBox1.Items.Count > 0)
{
listBox1.SelectedIndex = 0;
}
//this.pictureBox1.Dock = DockStyle.None;
//SetCenterScreen(pictureBox1);
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<annotation>
<folder>ignore</folder>
<filename>4_0069063759G.jpg</filename>
<path>ignore</path>
<source>
<database>Unknown</database>
</source>
<plate>KLE-7668</plate>
<size>
<width>1392</width>
<height>1040</height>
<depth>1</depth>
</size>
<segmented>0</segmented>
<object>
<name>plate</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>657</xmin>
<ymin>306</ymin>
<xmax>811</xmax>
<ymax>403</ymax>
</bndbox>
</object>
</annotation>
\ No newline at end of file
<annotation>
<folder>ignore</folder>
<filename>4_0069063759G.jpg</filename>
<path>ignore</path>
<source>
<database>Unknown</database>
</source>
<plate>KLE-7668</plate>
<size>
<width>136</width>
<height>73</height>
<depth>1</depth>
</size>
<segmented>0</segmented>
<object>
<name>K</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>14</xmin>
<ymin>23</ymin>
<xmax>31</xmax>
<ymax>51</ymax>
</bndbox>
</object>
<object>
<name>L</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>28</xmin>
<ymin>23</ymin>
<xmax>45</xmax>
<ymax>51</ymax>
</bndbox>
</object>
<object>
<name>E</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>43</xmin>
<ymin>22</ymin>
<xmax>60</xmax>
<ymax>50</ymax>
</bndbox>
</object>
<object>
<name>7</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>60</xmin>
<ymin>22</ymin>
<xmax>77</xmax>
<ymax>50</ymax>
</bndbox>
</object>
<object>
<name>6</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>74</xmin>
<ymin>21</ymin>
<xmax>91</xmax>
<ymax>49</ymax>
</bndbox>
</object>
<object>
<name>6</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>90</xmin>
<ymin>21</ymin>
<xmax>105</xmax>
<ymax>49</ymax>
</bndbox>
</object>
<object>
<name>8</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>103</xmin>
<ymin>21</ymin>
<xmax>119</xmax>
<ymax>49</ymax>
</bndbox>
</object>
</annotation>
\ No newline at end of file
0. KLE-7668 fuzzy KLE7668 = 0.525822829131653
1. KLB-3873 fuzzy KLB3873 = 0.525822829131653
2. 9238-N8 fuzzy 9238N8 = 0.527380952380952
3. BDL-1637 fuzzy BDL1637 = 0.525822829131653
0. KLE-7669GO fuzzy KLE7668 = 0.273989661654135
1. KLB-3879 fuzzy KLB3873 = 0.435749299719888
2. 9238-N9 fuzzy 9238N8 = 0.442857142857143
3. BDL-1639 fuzzy BDL1637 = 0.435749299719888
4. 187-H9 fuzzy 1879 = 0.384469696969697
5. AWU-1392 fuzzy AWU392 = 0.394886363636364
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