led
This commit is contained in:
@@ -34,6 +34,7 @@ namespace Camera
|
||||
private ConcurrentDictionary<int, Color> _ledZoneColors = new ConcurrentDictionary<int, Color>();
|
||||
private ConcurrentDictionary<int, string> _ledZoneDetectionResults = new ConcurrentDictionary<int, string>();
|
||||
private ConcurrentDictionary<int, Tuple<double, double, double>> _ledZoneHsvValues = new ConcurrentDictionary<int, Tuple<double, double, double>>();
|
||||
private ConcurrentDictionary<int, bool> _ledZoneVisibility = new ConcurrentDictionary<int, bool>();
|
||||
private LedDetector _ledDetector = new LedDetector();
|
||||
|
||||
public void SetLedDetectorParams(int brightLimit, int satLimit)
|
||||
@@ -427,6 +428,18 @@ namespace Camera
|
||||
return Color.Lime;
|
||||
}
|
||||
|
||||
public bool GetLedZoneVisibility(int index)
|
||||
{
|
||||
if (_ledZoneVisibility.ContainsKey(index))
|
||||
return _ledZoneVisibility[index];
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetLedZoneVisibility(int index, bool visible)
|
||||
{
|
||||
_ledZoneVisibility[index] = visible;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取LED区域检测结果
|
||||
/// </summary>
|
||||
|
||||
@@ -132,7 +132,6 @@ namespace Camera
|
||||
private bool _isEditingLedZone = false;
|
||||
private bool _isDrawingLedMode = false;
|
||||
private int _ledZoneState = 0;
|
||||
private bool _showLedZones = true;
|
||||
private Color _detectionZoneColor = Color.Black;
|
||||
private ConcurrentDictionary<int, Color> _ledZoneColors = new ConcurrentDictionary<int, Color>();
|
||||
private ConcurrentDictionary<int, string> _ledZoneDetectionResults = new ConcurrentDictionary<int, string>();
|
||||
@@ -382,8 +381,8 @@ namespace Camera
|
||||
var hsvValues = _camera.GetLedZoneHsvValues();
|
||||
foreach (var kvp in allLedZones)
|
||||
{
|
||||
if (!_showLedZones) continue;
|
||||
int index = kvp.Key;
|
||||
if (index == _selectedZoneIndex && _selectedZoneIndex >= 0 && !_camera.GetLedZoneVisibility(_selectedZoneIndex)) continue;
|
||||
Rectangle ledZone = kvp.Value;
|
||||
Color ledColor = _camera.GetLedZoneColor(index);
|
||||
string detectionResult = _camera.GetLedZoneDetectionResult(index);
|
||||
@@ -598,6 +597,7 @@ namespace Camera
|
||||
foreach (var kvp in allLedZones)
|
||||
{
|
||||
int index = kvp.Key;
|
||||
if (index == _selectedZoneIndex && _selectedZoneIndex >= 0 && !_camera.GetLedZoneVisibility(_selectedZoneIndex)) continue;
|
||||
Rectangle ledZone = kvp.Value;
|
||||
Color ledColor = _camera.GetLedZoneColor(index);
|
||||
|
||||
@@ -651,6 +651,7 @@ namespace Camera
|
||||
foreach (var kvp in allLedZones)
|
||||
{
|
||||
int index = kvp.Key;
|
||||
if (index == _selectedZoneIndex && _selectedZoneIndex >= 0 && !_camera.GetLedZoneVisibility(_selectedZoneIndex)) continue;
|
||||
Rectangle ledZone = kvp.Value;
|
||||
Color ledColor = _camera.GetLedZoneColor(index);
|
||||
|
||||
@@ -705,6 +706,7 @@ namespace Camera
|
||||
foreach (var kvp in allLedZones)
|
||||
{
|
||||
int index = kvp.Key;
|
||||
if (!_camera.GetLedZoneVisibility(index)) continue;
|
||||
Rectangle ledZone = kvp.Value;
|
||||
Color ledColor = _camera.GetLedZoneColor(index);
|
||||
|
||||
@@ -1295,6 +1297,7 @@ namespace Camera
|
||||
toolStripNumericUpDown2.Value = zone.Y;
|
||||
toolStripNumericUpDown3.Value = zone.Width;
|
||||
toolStripNumericUpDown4.Value = zone.Height;
|
||||
toolStripButton5.Checked = _camera.GetLedZoneVisibility(_selectedZoneIndex);
|
||||
}
|
||||
foreach (DataGridViewRow row in dataGridView2.Rows)
|
||||
{
|
||||
@@ -1710,8 +1713,11 @@ namespace Camera
|
||||
// 显示Led框复选框事件
|
||||
private void ToolStripButton5_Click(object sender, EventArgs e)
|
||||
{
|
||||
_showLedZones = toolStripButton5.Checked;
|
||||
picBoxCamera.Invalidate();
|
||||
if (_camera != null && _selectedZoneIndex >= 0)
|
||||
{
|
||||
_camera.SetLedZoneVisibility(_selectedZoneIndex, toolStripButton5.Checked);
|
||||
}
|
||||
picBoxCamera.Refresh();
|
||||
}
|
||||
|
||||
// 红绿蓝阈值事件
|
||||
|
||||
Reference in New Issue
Block a user