Camera ROI modified for the use of 'periods', ver. 2.12.450

This commit is contained in:
Milan Hanajik
2017-01-27 14:34:17 +01:00
parent 3b13756db9
commit 3f311d8603
6 changed files with 157 additions and 49 deletions
@@ -115,7 +115,9 @@ namespace TBF.BenchControl.Network.Camera.Roi
{
RoiCfg.RoiParams = tmpcfg.RoiParams;
RoiCfg.UseTestImages = tmpcfg.UseTestImages;
RoiCfg.TestImagesCount = tmpcfg.TestImagesCount;
RoiCfg.DetectionImagesCount = tmpcfg.DetectionImagesCount;
RoiCfg.DetectionPeriod1 = tmpcfg.DetectionPeriod1;
RoiCfg.DetectionPeriod2 = tmpcfg.DetectionPeriod2;
}
}
};
@@ -16,8 +16,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
///
public string PreviousRoi;
public string RoiParams;
public int DetectionImagesCount;
public int DetectionPeriod1;
public int DetectionPeriod2;
public bool UseTestImages;
public int TestImagesCount;
/// <summary> Procedure parameters </summary>
[XmlIgnore]
@@ -43,6 +45,9 @@ namespace TBF.BenchControl.Network.Camera.Roi
Factory = factory;
ParentName = "Camera";
RoiParams = string.Empty;
DetectionImagesCount = 15;
DetectionPeriod1 = 1;
DetectionPeriod2 = 1;
}
public string ToString(int i)
@@ -70,7 +70,9 @@ namespace TBF.BenchControl.Network.Camera.Roi
previousRoiComboBox.Text = string.IsNullOrEmpty(config.PreviousRoi) ? "---" : config.PreviousRoi;
argsTextBox.Text = config.RoiParams;
useTestImagesCheckBox.Checked = config.UseTestImages;
testImagesCountTextBox.Text = config.TestImagesCount.ToString();
imagesCountTextBox.Text = config.DetectionImagesCount.ToString();
period1TextBox.Text = config.DetectionPeriod1.ToString();
period2TextBox.Text = config.DetectionPeriod2.ToString();
}
public void Unlock()
@@ -80,7 +82,9 @@ namespace TBF.BenchControl.Network.Camera.Roi
previousRoiComboBox.Enabled = true;
argsTextBox.Enabled = true;
useTestImagesCheckBox.Enabled = true;
testImagesCountTextBox.Enabled = true;
imagesCountTextBox.Enabled = true;
period1TextBox.Enabled = true;
period2TextBox.Enabled = true;
}
public CfgUpdateFlags UpdateCfg()
@@ -123,9 +127,23 @@ namespace TBF.BenchControl.Network.Camera.Roi
Roi.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
}
if (config.TestImagesCount != int.Parse(testImagesCountTextBox.Text))
if (config.DetectionImagesCount != int.Parse(imagesCountTextBox.Text))
{
config.TestImagesCount = int.Parse(testImagesCountTextBox.Text);
config.DetectionImagesCount = int.Parse(imagesCountTextBox.Text);
flags |= CfgUpdateFlags.AnyChange;
Roi.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
}
if (config.DetectionPeriod1 != int.Parse(period1TextBox.Text))
{
config.DetectionPeriod1 = int.Parse(period1TextBox.Text);
flags |= CfgUpdateFlags.AnyChange;
Roi.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
}
if (config.DetectionPeriod2 != int.Parse(period2TextBox.Text))
{
config.DetectionPeriod2 = int.Parse(period2TextBox.Text);
flags |= CfgUpdateFlags.AnyChange;
Roi.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
}
@@ -149,12 +167,32 @@ namespace TBF.BenchControl.Network.Camera.Roi
message += Environment.NewLine + "Invalid 'Previous RoI'";
}
int dummy;
if (!int.TryParse(testImagesCountTextBox.Text, out dummy) || dummy < 1 || dummy > 50)
int cnt, p1, p2;
if (!int.TryParse(imagesCountTextBox.Text, out cnt) || cnt < 1 || cnt > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Images count' should be between 1 and 50";
}
if (!int.TryParse(period1TextBox.Text, out p1) || p1 < 1 || p1 > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Period 1' should be between 1 and 50";
}
if (!int.TryParse(period2TextBox.Text, out p2) || p2 < 1 || p2 > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Period 2' should be between 1 and 50";
}
if (p2 < p1)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Period2 should >= Period1";
}
if (p2 > p1 && (cnt % 2) != 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "When Period2 > Period1, 'Images count' should be even";
}
return flags;
}
@@ -44,15 +44,21 @@ namespace TBF.BenchControl.Network.Camera.Roi
this.previousRoiLabel = new System.Windows.Forms.Label();
this.helpLabel1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.testImagesCountTextBox = new System.Windows.Forms.TextBox();
this.testImagesCountLabel = new System.Windows.Forms.Label();
this.imagesCountTextBox = new System.Windows.Forms.TextBox();
this.imagesCountLabel = new System.Windows.Forms.Label();
this.useTestImagesCheckBox = new System.Windows.Forms.CheckBox();
this.period1TextBox = new System.Windows.Forms.TextBox();
this.period1Label = new System.Windows.Forms.Label();
this.period2TextBox = new System.Windows.Forms.TextBox();
this.period2Label = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// argsTextBox
//
this.argsTextBox.Enabled = false;
this.argsTextBox.Location = new System.Drawing.Point(104, 127);
this.argsTextBox.Location = new System.Drawing.Point(92, 19);
this.argsTextBox.Name = "argsTextBox";
this.argsTextBox.Size = new System.Drawing.Size(361, 20);
this.argsTextBox.TabIndex = 7;
@@ -60,7 +66,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
// argsLabel
//
this.argsLabel.AutoSize = true;
this.argsLabel.Location = new System.Drawing.Point(18, 130);
this.argsLabel.Location = new System.Drawing.Point(6, 22);
this.argsLabel.Name = "argsLabel";
this.argsLabel.Size = new System.Drawing.Size(57, 13);
this.argsLabel.TabIndex = 6;
@@ -69,7 +75,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(18, 76);
this.parentNameLabel.Location = new System.Drawing.Point(13, 60);
this.parentNameLabel.Name = "parentNameLabel";
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
this.parentNameLabel.TabIndex = 2;
@@ -78,7 +84,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(104, 47);
this.nameTextBox.Location = new System.Drawing.Point(99, 34);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(174, 20);
this.nameTextBox.TabIndex = 1;
@@ -86,7 +92,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(18, 50);
this.nameLabel.Location = new System.Drawing.Point(13, 37);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 0;
@@ -95,7 +101,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(101, 21);
this.classNameLabel.Location = new System.Drawing.Point(96, 11);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(114, 13);
this.classNameLabel.TabIndex = 0;
@@ -105,7 +111,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(104, 73);
this.parentNameComboBox.Location = new System.Drawing.Point(99, 57);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(174, 21);
this.parentNameComboBox.TabIndex = 3;
@@ -131,7 +137,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
//
this.previousRoiComboBox.Enabled = false;
this.previousRoiComboBox.FormattingEnabled = true;
this.previousRoiComboBox.Location = new System.Drawing.Point(104, 100);
this.previousRoiComboBox.Location = new System.Drawing.Point(99, 81);
this.previousRoiComboBox.Name = "previousRoiComboBox";
this.previousRoiComboBox.Size = new System.Drawing.Size(174, 21);
this.previousRoiComboBox.TabIndex = 5;
@@ -139,7 +145,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
// previousRoiLabel
//
this.previousRoiLabel.AutoSize = true;
this.previousRoiLabel.Location = new System.Drawing.Point(18, 103);
this.previousRoiLabel.Location = new System.Drawing.Point(13, 84);
this.previousRoiLabel.Name = "previousRoiLabel";
this.previousRoiLabel.Size = new System.Drawing.Size(68, 13);
this.previousRoiLabel.TabIndex = 4;
@@ -148,7 +154,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
// helpLabel1
//
this.helpLabel1.AutoSize = true;
this.helpLabel1.Location = new System.Drawing.Point(103, 156);
this.helpLabel1.Location = new System.Drawing.Point(91, 44);
this.helpLabel1.Name = "helpLabel1";
this.helpLabel1.Size = new System.Drawing.Size(379, 13);
this.helpLabel1.TabIndex = 8;
@@ -158,56 +164,104 @@ namespace TBF.BenchControl.Network.Camera.Roi
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(102, 174);
this.label2.Location = new System.Drawing.Point(90, 62);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(350, 13);
this.label2.TabIndex = 9;
this.label2.Text = "... angSpeed( - ccw +cw) initSpeed minMvmt maxFwdMvmt bkgndCorr";
//
// testImagesCountTextBox
// imagesCountTextBox
//
this.testImagesCountTextBox.Enabled = false;
this.testImagesCountTextBox.Location = new System.Drawing.Point(104, 226);
this.testImagesCountTextBox.Name = "testImagesCountTextBox";
this.testImagesCountTextBox.Size = new System.Drawing.Size(46, 20);
this.testImagesCountTextBox.TabIndex = 19;
this.imagesCountTextBox.Enabled = false;
this.imagesCountTextBox.Location = new System.Drawing.Point(92, 84);
this.imagesCountTextBox.Name = "imagesCountTextBox";
this.imagesCountTextBox.Size = new System.Drawing.Size(46, 20);
this.imagesCountTextBox.TabIndex = 19;
//
// testImagesCountLabel
// imagesCountLabel
//
this.testImagesCountLabel.AutoSize = true;
this.testImagesCountLabel.Location = new System.Drawing.Point(18, 229);
this.testImagesCountLabel.Name = "testImagesCountLabel";
this.testImagesCountLabel.Size = new System.Drawing.Size(71, 13);
this.testImagesCountLabel.TabIndex = 18;
this.testImagesCountLabel.Text = "Images count";
this.imagesCountLabel.AutoSize = true;
this.imagesCountLabel.Location = new System.Drawing.Point(6, 87);
this.imagesCountLabel.Name = "imagesCountLabel";
this.imagesCountLabel.Size = new System.Drawing.Size(71, 13);
this.imagesCountLabel.TabIndex = 18;
this.imagesCountLabel.Text = "Images count";
//
// useTestImagesCheckBox
//
this.useTestImagesCheckBox.AutoSize = true;
this.useTestImagesCheckBox.Enabled = false;
this.useTestImagesCheckBox.Location = new System.Drawing.Point(104, 205);
this.useTestImagesCheckBox.Location = new System.Drawing.Point(183, 87);
this.useTestImagesCheckBox.Name = "useTestImagesCheckBox";
this.useTestImagesCheckBox.Size = new System.Drawing.Size(101, 17);
this.useTestImagesCheckBox.TabIndex = 17;
this.useTestImagesCheckBox.Text = "Use test images";
this.useTestImagesCheckBox.UseVisualStyleBackColor = true;
//
// period1TextBox
//
this.period1TextBox.Enabled = false;
this.period1TextBox.Location = new System.Drawing.Point(92, 107);
this.period1TextBox.Name = "period1TextBox";
this.period1TextBox.Size = new System.Drawing.Size(46, 20);
this.period1TextBox.TabIndex = 21;
//
// period1Label
//
this.period1Label.AutoSize = true;
this.period1Label.Location = new System.Drawing.Point(6, 110);
this.period1Label.Name = "period1Label";
this.period1Label.Size = new System.Drawing.Size(46, 13);
this.period1Label.TabIndex = 20;
this.period1Label.Text = "Period 1";
//
// period2TextBox
//
this.period2TextBox.Enabled = false;
this.period2TextBox.Location = new System.Drawing.Point(92, 130);
this.period2TextBox.Name = "period2TextBox";
this.period2TextBox.Size = new System.Drawing.Size(46, 20);
this.period2TextBox.TabIndex = 23;
//
// period2Label
//
this.period2Label.AutoSize = true;
this.period2Label.Location = new System.Drawing.Point(6, 133);
this.period2Label.Name = "period2Label";
this.period2Label.Size = new System.Drawing.Size(46, 13);
this.period2Label.TabIndex = 22;
this.period2Label.Text = "Period 2";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.argsTextBox);
this.groupBox1.Controls.Add(this.period2TextBox);
this.groupBox1.Controls.Add(this.argsLabel);
this.groupBox1.Controls.Add(this.period2Label);
this.groupBox1.Controls.Add(this.helpLabel1);
this.groupBox1.Controls.Add(this.period1TextBox);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.period1Label);
this.groupBox1.Controls.Add(this.useTestImagesCheckBox);
this.groupBox1.Controls.Add(this.imagesCountTextBox);
this.groupBox1.Controls.Add(this.imagesCountLabel);
this.groupBox1.Location = new System.Drawing.Point(7, 110);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(477, 169);
this.groupBox1.TabIndex = 24;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "ROI Detection";
//
// RoiCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.testImagesCountTextBox);
this.Controls.Add(this.testImagesCountLabel);
this.Controls.Add(this.useTestImagesCheckBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.helpLabel1);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.previousRoiComboBox);
this.Controls.Add(this.previousRoiLabel);
this.Controls.Add(this.parentNameComboBox);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.argsTextBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.argsLabel);
this.Controls.Add(this.parentNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
@@ -215,6 +269,8 @@ namespace TBF.BenchControl.Network.Camera.Roi
this.Name = "RoiCfgCtrl";
this.Size = new System.Drawing.Size(500, 300);
this.Load += new System.EventHandler(this.PumpCfgCtrl_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -235,8 +291,13 @@ namespace TBF.BenchControl.Network.Camera.Roi
private System.Windows.Forms.Label previousRoiLabel;
private System.Windows.Forms.Label helpLabel1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox testImagesCountTextBox;
private System.Windows.Forms.Label testImagesCountLabel;
private System.Windows.Forms.TextBox imagesCountTextBox;
private System.Windows.Forms.Label imagesCountLabel;
private System.Windows.Forms.CheckBox useTestImagesCheckBox;
private System.Windows.Forms.TextBox period1TextBox;
private System.Windows.Forms.Label period1Label;
private System.Windows.Forms.TextBox period2TextBox;
private System.Windows.Forms.Label period2Label;
private System.Windows.Forms.GroupBox groupBox1;
}
}
@@ -87,12 +87,14 @@ namespace TBF.BenchControl.Network.Camera.Roi
}
masks += string.Format(" -m {0} {1} {2} {3}", previous.RoiX.Val, previous.RoiY.Val,
previous.RoiWid.Val, previous.RoiHgh.Val);
previous.RoiWid.Val, previous.RoiHgh.Val);
previous = previous.PreviousRoi;
}
command = string.Format("clp/RoiDetection{0}{1} {2}",
command = string.Format("clp/RoiDetection{0}{1}{2}{3} {4}",
masks,
roiCfg.UseTestImages ? (" -l " + roiCfg.TestImagesCount.ToString()) : string.Empty,
string.Format(roiCfg.UseTestImages ? " -l {0}" : " -n {0}", roiCfg.DetectionImagesCount),
string.Format(" -p1 {0}", roiCfg.DetectionPeriod1),
string.Format(" -p2 {0}", roiCfg.DetectionPeriod2),
roiCfg.RoiParams);
//
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.12.449.1")]
[assembly: AssemblyFileVersion("2.12.449.1")]
[assembly: AssemblyVersion("2.12.450.1")]
[assembly: AssemblyFileVersion("2.12.450.1")]