增加颜色判断参数
This commit is contained in:
@@ -51,6 +51,24 @@ namespace Camera
|
|||||||
{
|
{
|
||||||
return _ledDetector.SatLimit;
|
return _ledDetector.SatLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetColorThresholds(int redMin, int redMax, int greenMin, int greenMax, int blueMin, int blueMax)
|
||||||
|
{
|
||||||
|
_ledDetector.RedMin = redMin;
|
||||||
|
_ledDetector.RedMax = redMax;
|
||||||
|
_ledDetector.GreenMin = greenMin;
|
||||||
|
_ledDetector.GreenMax = greenMax;
|
||||||
|
_ledDetector.BlueMin = blueMin;
|
||||||
|
_ledDetector.BlueMax = blueMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetRedMin() { return _ledDetector.RedMin; }
|
||||||
|
public int GetRedMax() { return _ledDetector.RedMax; }
|
||||||
|
public int GetGreenMin() { return _ledDetector.GreenMin; }
|
||||||
|
public int GetGreenMax() { return _ledDetector.GreenMax; }
|
||||||
|
public int GetBlueMin() { return _ledDetector.BlueMin; }
|
||||||
|
public int GetBlueMax() { return _ledDetector.BlueMax; }
|
||||||
|
|
||||||
private Color _detectionZoneColor = Color.Black;
|
private Color _detectionZoneColor = Color.Black;
|
||||||
|
|
||||||
// 检测状态
|
// 检测状态
|
||||||
@@ -488,6 +506,9 @@ namespace Camera
|
|||||||
|
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
writer.WriteLine(string.Format("亮灭阈值,{0},{1}", _ledDetector.BrightLimit, _ledDetector.SatLimit));
|
writer.WriteLine(string.Format("亮灭阈值,{0},{1}", _ledDetector.BrightLimit, _ledDetector.SatLimit));
|
||||||
|
writer.WriteLine(string.Format("红阈值,{0},{1}", _ledDetector.RedMin, _ledDetector.RedMax));
|
||||||
|
writer.WriteLine(string.Format("绿阈值,{0},{1}", _ledDetector.GreenMin, _ledDetector.GreenMax));
|
||||||
|
writer.WriteLine(string.Format("蓝阈值,{0},{1}", _ledDetector.BlueMin, _ledDetector.BlueMax));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
@@ -532,6 +553,33 @@ namespace Camera
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parts.Length >= 3 && parts[0] == "红阈值")
|
||||||
|
{
|
||||||
|
if (int.TryParse(parts[1], out int redMin))
|
||||||
|
_ledDetector.RedMin = redMin;
|
||||||
|
if (int.TryParse(parts[2], out int redMax))
|
||||||
|
_ledDetector.RedMax = redMax;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parts.Length >= 3 && parts[0] == "绿阈值")
|
||||||
|
{
|
||||||
|
if (int.TryParse(parts[1], out int greenMin))
|
||||||
|
_ledDetector.GreenMin = greenMin;
|
||||||
|
if (int.TryParse(parts[2], out int greenMax))
|
||||||
|
_ledDetector.GreenMax = greenMax;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parts.Length >= 3 && parts[0] == "蓝阈值")
|
||||||
|
{
|
||||||
|
if (int.TryParse(parts[1], out int blueMin))
|
||||||
|
_ledDetector.BlueMin = blueMin;
|
||||||
|
if (int.TryParse(parts[2], out int blueMax))
|
||||||
|
_ledDetector.BlueMax = blueMax;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (parts.Length >= 4)
|
if (parts.Length >= 4)
|
||||||
{
|
{
|
||||||
if (isDetectionZone)
|
if (isDetectionZone)
|
||||||
|
|||||||
@@ -12,6 +12,13 @@ public class LedDetector
|
|||||||
private int _brightLimit = 110;
|
private int _brightLimit = 110;
|
||||||
private int _satLimit = 35;
|
private int _satLimit = 35;
|
||||||
|
|
||||||
|
private int _redMin = 60;
|
||||||
|
private int _redMax = 75;
|
||||||
|
private int _greenMin = 30;
|
||||||
|
private int _greenMax = 60;
|
||||||
|
private int _blueMin = 90;
|
||||||
|
private int _blueMax = 130;
|
||||||
|
|
||||||
public int BrightLimit
|
public int BrightLimit
|
||||||
{
|
{
|
||||||
get { return _brightLimit; }
|
get { return _brightLimit; }
|
||||||
@@ -24,6 +31,42 @@ public class LedDetector
|
|||||||
set { _satLimit = value; }
|
set { _satLimit = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int RedMin
|
||||||
|
{
|
||||||
|
get { return _redMin; }
|
||||||
|
set { _redMin = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int RedMax
|
||||||
|
{
|
||||||
|
get { return _redMax; }
|
||||||
|
set { _redMax = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GreenMin
|
||||||
|
{
|
||||||
|
get { return _greenMin; }
|
||||||
|
set { _greenMin = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GreenMax
|
||||||
|
{
|
||||||
|
get { return _greenMax; }
|
||||||
|
set { _greenMax = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int BlueMin
|
||||||
|
{
|
||||||
|
get { return _blueMin; }
|
||||||
|
set { _blueMin = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int BlueMax
|
||||||
|
{
|
||||||
|
get { return _blueMax; }
|
||||||
|
set { _blueMax = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public Tuple<LedState, LedColor, double, double, double> Detect(Image<Bgr, byte> image, Rectangle roi)
|
public Tuple<LedState, LedColor, double, double, double> Detect(Image<Bgr, byte> image, Rectangle roi)
|
||||||
{
|
{
|
||||||
using (Image<Bgr, byte> subImg = image.GetSubRect(roi))
|
using (Image<Bgr, byte> subImg = image.GetSubRect(roi))
|
||||||
@@ -41,7 +84,7 @@ public class LedDetector
|
|||||||
S.Dispose();
|
S.Dispose();
|
||||||
V.Dispose();
|
V.Dispose();
|
||||||
|
|
||||||
bool isOn = avgV > _brightLimit && avgS > _satLimit;
|
bool isOn = avgV > _brightLimit && avgS < _satLimit;
|
||||||
|
|
||||||
if (!isOn)
|
if (!isOn)
|
||||||
{
|
{
|
||||||
@@ -49,11 +92,11 @@ public class LedDetector
|
|||||||
}
|
}
|
||||||
|
|
||||||
LedColor color = LedColor.Unknown;
|
LedColor color = LedColor.Unknown;
|
||||||
if ((avgH >= 60 && avgH < 75))
|
if ((avgH >= _redMin && avgH < _redMax))
|
||||||
color = LedColor.Red;
|
color = LedColor.Red;
|
||||||
else if (avgH >= 30 && avgH < 60)
|
else if (avgH >= _greenMin && avgH < _greenMax)
|
||||||
color = LedColor.Green;
|
color = LedColor.Green;
|
||||||
else if (avgH >= 90 && avgH < 130)
|
else if (avgH >= _blueMin && avgH < _blueMax)
|
||||||
color = LedColor.Blue;
|
color = LedColor.Blue;
|
||||||
|
|
||||||
return new Tuple<LedState, LedColor, double, double, double>(LedState.On, color, avgH, avgS, avgV);
|
return new Tuple<LedState, LedColor, double, double, double>(LedState.On, color, avgH, avgS, avgV);
|
||||||
|
|||||||
@@ -40,6 +40,16 @@ namespace Camera
|
|||||||
this.toolStripNumericUpDown3 = new ToolStripNumericUpDown();
|
this.toolStripNumericUpDown3 = new ToolStripNumericUpDown();
|
||||||
this.toolStripLabel4 = new System.Windows.Forms.ToolStripLabel();
|
this.toolStripLabel4 = new System.Windows.Forms.ToolStripLabel();
|
||||||
this.toolStripNumericUpDown4 = new ToolStripNumericUpDown();
|
this.toolStripNumericUpDown4 = new ToolStripNumericUpDown();
|
||||||
|
this.toolStrip4 = new System.Windows.Forms.ToolStrip();
|
||||||
|
this.toolStripLabel7 = new System.Windows.Forms.ToolStripLabel();
|
||||||
|
this.toolStripNumericUpDown7 = new ToolStripNumericUpDown();
|
||||||
|
this.toolStripNumericUpDown8 = new ToolStripNumericUpDown();
|
||||||
|
this.toolStripLabel9 = new System.Windows.Forms.ToolStripLabel();
|
||||||
|
this.toolStripNumericUpDown9 = new ToolStripNumericUpDown();
|
||||||
|
this.toolStripNumericUpDown10 = new ToolStripNumericUpDown();
|
||||||
|
this.toolStripLabel11 = new System.Windows.Forms.ToolStripLabel();
|
||||||
|
this.toolStripNumericUpDown11 = new ToolStripNumericUpDown();
|
||||||
|
this.toolStripNumericUpDown12 = new ToolStripNumericUpDown();
|
||||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||||
this.dataGridView2 = new System.Windows.Forms.DataGridView();
|
this.dataGridView2 = new System.Windows.Forms.DataGridView();
|
||||||
@@ -51,6 +61,7 @@ namespace Camera
|
|||||||
this.toolStrip1.SuspendLayout();
|
this.toolStrip1.SuspendLayout();
|
||||||
this.toolStrip2.SuspendLayout();
|
this.toolStrip2.SuspendLayout();
|
||||||
this.toolStrip3.SuspendLayout();
|
this.toolStrip3.SuspendLayout();
|
||||||
|
this.toolStrip4.SuspendLayout();
|
||||||
this.toolStripContainer1.SuspendLayout();
|
this.toolStripContainer1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
||||||
this.splitContainer2.Panel1.SuspendLayout();
|
this.splitContainer2.Panel1.SuspendLayout();
|
||||||
@@ -107,6 +118,7 @@ namespace Camera
|
|||||||
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip1);
|
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip1);
|
||||||
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip2);
|
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip2);
|
||||||
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip3);
|
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip3);
|
||||||
|
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip4);
|
||||||
//
|
//
|
||||||
// toolStripContainer1.ContentPanel
|
// toolStripContainer1.ContentPanel
|
||||||
//
|
//
|
||||||
@@ -210,6 +222,25 @@ namespace Camera
|
|||||||
this.toolStrip3.TabIndex = 2;
|
this.toolStrip3.TabIndex = 2;
|
||||||
this.toolStrip3.Visible = true;
|
this.toolStrip3.Visible = true;
|
||||||
//
|
//
|
||||||
|
// toolStrip4
|
||||||
|
//
|
||||||
|
this.toolStrip4.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
this.toolStrip4.ImageScalingSize = new System.Drawing.Size(32, 32);
|
||||||
|
this.toolStrip4.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.toolStripLabel7,
|
||||||
|
this.toolStripNumericUpDown7,
|
||||||
|
this.toolStripNumericUpDown8,
|
||||||
|
this.toolStripLabel9,
|
||||||
|
this.toolStripNumericUpDown9,
|
||||||
|
this.toolStripNumericUpDown10,
|
||||||
|
this.toolStripLabel11,
|
||||||
|
this.toolStripNumericUpDown11,
|
||||||
|
this.toolStripNumericUpDown12});
|
||||||
|
this.toolStrip4.Location = new System.Drawing.Point(0, 85);
|
||||||
|
this.toolStrip4.Name = "toolStrip4";
|
||||||
|
this.toolStrip4.Size = new System.Drawing.Size(559, 30);
|
||||||
|
this.toolStrip4.TabIndex = 3;
|
||||||
|
//
|
||||||
// toolStripLabel5
|
// toolStripLabel5
|
||||||
//
|
//
|
||||||
this.toolStripLabel5.Name = "toolStripLabel5";
|
this.toolStripLabel5.Name = "toolStripLabel5";
|
||||||
@@ -278,6 +309,159 @@ namespace Camera
|
|||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
//
|
//
|
||||||
|
// toolStripLabel7
|
||||||
|
//
|
||||||
|
this.toolStripLabel7.Name = "toolStripLabel7";
|
||||||
|
this.toolStripLabel7.Size = new System.Drawing.Size(32, 27);
|
||||||
|
this.toolStripLabel7.Text = "红";
|
||||||
|
//
|
||||||
|
// toolStripNumericUpDown7
|
||||||
|
//
|
||||||
|
this.toolStripNumericUpDown7.AutoSize = false;
|
||||||
|
this.toolStripNumericUpDown7.DecimalPlaces = 0;
|
||||||
|
this.toolStripNumericUpDown7.Increment = new decimal(new int[] {
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown7.Maximum = new decimal(new int[] {
|
||||||
|
180,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown7.Minimum = new decimal(new int[] {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown7.Name = "toolStripNumericUpDown7";
|
||||||
|
this.toolStripNumericUpDown7.Size = new System.Drawing.Size(60, 27);
|
||||||
|
this.toolStripNumericUpDown7.Value = new decimal(new int[] {
|
||||||
|
60,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// toolStripLabel9
|
||||||
|
//
|
||||||
|
this.toolStripLabel9.Name = "toolStripLabel9";
|
||||||
|
this.toolStripLabel9.Size = new System.Drawing.Size(32, 27);
|
||||||
|
this.toolStripLabel9.Text = "绿";
|
||||||
|
//
|
||||||
|
// toolStripNumericUpDown9
|
||||||
|
//
|
||||||
|
this.toolStripNumericUpDown9.AutoSize = false;
|
||||||
|
this.toolStripNumericUpDown9.DecimalPlaces = 0;
|
||||||
|
this.toolStripNumericUpDown9.Increment = new decimal(new int[] {
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown9.Maximum = new decimal(new int[] {
|
||||||
|
180,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown9.Minimum = new decimal(new int[] {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown9.Name = "toolStripNumericUpDown9";
|
||||||
|
this.toolStripNumericUpDown9.Size = new System.Drawing.Size(60, 27);
|
||||||
|
this.toolStripNumericUpDown9.Value = new decimal(new int[] {
|
||||||
|
30,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// toolStripNumericUpDown10
|
||||||
|
//
|
||||||
|
this.toolStripNumericUpDown10.AutoSize = false;
|
||||||
|
this.toolStripNumericUpDown10.DecimalPlaces = 0;
|
||||||
|
this.toolStripNumericUpDown10.Increment = new decimal(new int[] {
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown10.Maximum = new decimal(new int[] {
|
||||||
|
180,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown10.Minimum = new decimal(new int[] {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown10.Name = "toolStripNumericUpDown10";
|
||||||
|
this.toolStripNumericUpDown10.Size = new System.Drawing.Size(60, 27);
|
||||||
|
this.toolStripNumericUpDown10.Value = new decimal(new int[] {
|
||||||
|
60,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// toolStripLabel11
|
||||||
|
//
|
||||||
|
this.toolStripLabel11.Name = "toolStripLabel11";
|
||||||
|
this.toolStripLabel11.Size = new System.Drawing.Size(32, 27);
|
||||||
|
this.toolStripLabel11.Text = "蓝";
|
||||||
|
//
|
||||||
|
// toolStripNumericUpDown11
|
||||||
|
//
|
||||||
|
this.toolStripNumericUpDown11.AutoSize = false;
|
||||||
|
this.toolStripNumericUpDown11.DecimalPlaces = 0;
|
||||||
|
this.toolStripNumericUpDown11.Increment = new decimal(new int[] {
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown11.Maximum = new decimal(new int[] {
|
||||||
|
180,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown11.Minimum = new decimal(new int[] {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown11.Name = "toolStripNumericUpDown11";
|
||||||
|
this.toolStripNumericUpDown11.Size = new System.Drawing.Size(60, 27);
|
||||||
|
this.toolStripNumericUpDown11.Value = new decimal(new int[] {
|
||||||
|
90,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// toolStripNumericUpDown12
|
||||||
|
//
|
||||||
|
this.toolStripNumericUpDown12.AutoSize = false;
|
||||||
|
this.toolStripNumericUpDown12.DecimalPlaces = 0;
|
||||||
|
this.toolStripNumericUpDown12.Increment = new decimal(new int[] {
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown12.Maximum = new decimal(new int[] {
|
||||||
|
180,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown12.Minimum = new decimal(new int[] {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.toolStripNumericUpDown12.Name = "toolStripNumericUpDown12";
|
||||||
|
this.toolStripNumericUpDown12.Size = new System.Drawing.Size(60, 27);
|
||||||
|
this.toolStripNumericUpDown12.Value = new decimal(new int[] {
|
||||||
|
130,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
// toolStripLabel1
|
// toolStripLabel1
|
||||||
//
|
//
|
||||||
this.toolStripLabel1.Name = "toolStripLabel1";
|
this.toolStripLabel1.Name = "toolStripLabel1";
|
||||||
@@ -419,6 +603,12 @@ namespace Camera
|
|||||||
this.toolStripNumericUpDown4.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown4_ValueChanged);
|
this.toolStripNumericUpDown4.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown4_ValueChanged);
|
||||||
this.toolStripNumericUpDown5.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown5_ValueChanged);
|
this.toolStripNumericUpDown5.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown5_ValueChanged);
|
||||||
this.toolStripNumericUpDown6.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown6_ValueChanged);
|
this.toolStripNumericUpDown6.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown6_ValueChanged);
|
||||||
|
this.toolStripNumericUpDown7.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown7_ValueChanged);
|
||||||
|
this.toolStripNumericUpDown8.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown8_ValueChanged);
|
||||||
|
this.toolStripNumericUpDown9.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown9_ValueChanged);
|
||||||
|
this.toolStripNumericUpDown10.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown10_ValueChanged);
|
||||||
|
this.toolStripNumericUpDown11.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown11_ValueChanged);
|
||||||
|
this.toolStripNumericUpDown12.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown12_ValueChanged);
|
||||||
//
|
//
|
||||||
// dataGridView1
|
// dataGridView1
|
||||||
//
|
//
|
||||||
@@ -497,6 +687,8 @@ namespace Camera
|
|||||||
this.toolStrip2.PerformLayout();
|
this.toolStrip2.PerformLayout();
|
||||||
this.toolStrip3.ResumeLayout(false);
|
this.toolStrip3.ResumeLayout(false);
|
||||||
this.toolStrip3.PerformLayout();
|
this.toolStrip3.PerformLayout();
|
||||||
|
this.toolStrip4.ResumeLayout(false);
|
||||||
|
this.toolStrip4.PerformLayout();
|
||||||
this.toolStripContainer1.ResumeLayout(false);
|
this.toolStripContainer1.ResumeLayout(false);
|
||||||
this.toolStripContainer1.PerformLayout();
|
this.toolStripContainer1.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
||||||
@@ -531,6 +723,16 @@ namespace Camera
|
|||||||
private ToolStripNumericUpDown toolStripNumericUpDown5;
|
private ToolStripNumericUpDown toolStripNumericUpDown5;
|
||||||
private System.Windows.Forms.ToolStripLabel toolStripLabel6;
|
private System.Windows.Forms.ToolStripLabel toolStripLabel6;
|
||||||
private ToolStripNumericUpDown toolStripNumericUpDown6;
|
private ToolStripNumericUpDown toolStripNumericUpDown6;
|
||||||
|
private System.Windows.Forms.ToolStrip toolStrip4;
|
||||||
|
private System.Windows.Forms.ToolStripLabel toolStripLabel7;
|
||||||
|
private ToolStripNumericUpDown toolStripNumericUpDown7;
|
||||||
|
private ToolStripNumericUpDown toolStripNumericUpDown8;
|
||||||
|
private System.Windows.Forms.ToolStripLabel toolStripLabel9;
|
||||||
|
private ToolStripNumericUpDown toolStripNumericUpDown9;
|
||||||
|
private ToolStripNumericUpDown toolStripNumericUpDown10;
|
||||||
|
private System.Windows.Forms.ToolStripLabel toolStripLabel11;
|
||||||
|
private ToolStripNumericUpDown toolStripNumericUpDown11;
|
||||||
|
private ToolStripNumericUpDown toolStripNumericUpDown12;
|
||||||
private System.Windows.Forms.DataGridView dataGridView1;
|
private System.Windows.Forms.DataGridView dataGridView1;
|
||||||
private System.Windows.Forms.SplitContainer splitContainer2;
|
private System.Windows.Forms.SplitContainer splitContainer2;
|
||||||
private System.Windows.Forms.DataGridView dataGridView2;
|
private System.Windows.Forms.DataGridView dataGridView2;
|
||||||
|
|||||||
@@ -223,6 +223,12 @@ namespace Camera
|
|||||||
_ledZoneColors = _camera.GetLedZoneColors();
|
_ledZoneColors = _camera.GetLedZoneColors();
|
||||||
toolStripNumericUpDown5.Value = _camera.GetBrightLimit();
|
toolStripNumericUpDown5.Value = _camera.GetBrightLimit();
|
||||||
toolStripNumericUpDown6.Value = _camera.GetSatLimit();
|
toolStripNumericUpDown6.Value = _camera.GetSatLimit();
|
||||||
|
toolStripNumericUpDown7.Value = _camera.GetRedMin();
|
||||||
|
toolStripNumericUpDown8.Value = _camera.GetRedMax();
|
||||||
|
toolStripNumericUpDown9.Value = _camera.GetGreenMin();
|
||||||
|
toolStripNumericUpDown10.Value = _camera.GetGreenMax();
|
||||||
|
toolStripNumericUpDown11.Value = _camera.GetBlueMin();
|
||||||
|
toolStripNumericUpDown12.Value = _camera.GetBlueMax();
|
||||||
}
|
}
|
||||||
picBoxCamera.BackColor = Color.Gray;
|
picBoxCamera.BackColor = Color.Gray;
|
||||||
splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||||
@@ -1495,6 +1501,7 @@ namespace Camera
|
|||||||
toolStripTextBox1.Visible = false;
|
toolStripTextBox1.Visible = false;
|
||||||
toolStripTextBox1.Text = "";
|
toolStripTextBox1.Text = "";
|
||||||
toolStrip3.Visible = true;
|
toolStrip3.Visible = true;
|
||||||
|
toolStrip4.Visible = true;
|
||||||
// 如果有LED区域则显示位置和宽高设置框
|
// 如果有LED区域则显示位置和宽高设置框
|
||||||
if (_camera != null && _camera.GetLedZoneCount() > 0)
|
if (_camera != null && _camera.GetLedZoneCount() > 0)
|
||||||
{
|
{
|
||||||
@@ -1531,6 +1538,7 @@ namespace Camera
|
|||||||
// 不显示位置和宽高设置框
|
// 不显示位置和宽高设置框
|
||||||
toolStrip2.Visible = false;
|
toolStrip2.Visible = false;
|
||||||
toolStrip3.Visible = false;
|
toolStrip3.Visible = false;
|
||||||
|
toolStrip4.Visible = false;
|
||||||
break;
|
break;
|
||||||
case 2: // 绘制状态
|
case 2: // 绘制状态
|
||||||
toolStripButton2.Visible = true;
|
toolStripButton2.Visible = true;
|
||||||
@@ -1540,6 +1548,7 @@ namespace Camera
|
|||||||
toolStripTextBox1.Text = "";
|
toolStripTextBox1.Text = "";
|
||||||
toolStrip2.Visible = false;
|
toolStrip2.Visible = false;
|
||||||
toolStrip3.Visible = false;
|
toolStrip3.Visible = false;
|
||||||
|
toolStrip4.Visible = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1695,5 +1704,53 @@ namespace Camera
|
|||||||
int satLimit = (int)toolStripNumericUpDown6.Value;
|
int satLimit = (int)toolStripNumericUpDown6.Value;
|
||||||
_camera.SetLedDetectorParams(brightLimit, satLimit);
|
_camera.SetLedDetectorParams(brightLimit, satLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 红绿蓝阈值事件
|
||||||
|
private void ToolStripNumericUpDown7_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_camera == null) return;
|
||||||
|
UpdateColorThresholds();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToolStripNumericUpDown8_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_camera == null) return;
|
||||||
|
UpdateColorThresholds();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToolStripNumericUpDown9_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_camera == null) return;
|
||||||
|
UpdateColorThresholds();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToolStripNumericUpDown10_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_camera == null) return;
|
||||||
|
UpdateColorThresholds();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToolStripNumericUpDown11_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_camera == null) return;
|
||||||
|
UpdateColorThresholds();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToolStripNumericUpDown12_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_camera == null) return;
|
||||||
|
UpdateColorThresholds();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateColorThresholds()
|
||||||
|
{
|
||||||
|
int redMin = (int)toolStripNumericUpDown7.Value;
|
||||||
|
int redMax = (int)toolStripNumericUpDown8.Value;
|
||||||
|
int greenMin = (int)toolStripNumericUpDown9.Value;
|
||||||
|
int greenMax = (int)toolStripNumericUpDown10.Value;
|
||||||
|
int blueMin = (int)toolStripNumericUpDown11.Value;
|
||||||
|
int blueMax = (int)toolStripNumericUpDown12.Value;
|
||||||
|
_camera.SetColorThresholds(redMin, redMax, greenMin, greenMax, blueMin, blueMax);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user