mirror of https://github.com/logchan/chuni-hands
change sensor locations
parent
ce95d8951f
commit
d7c90c22a4
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
@ -57,8 +58,18 @@ namespace chuni_hands {
|
|||
foreach (var sensor in Sensors) {
|
||||
var brush = sensor.Active ? Brushes.Green : Brushes.Red;
|
||||
var sz = sensor.Size;
|
||||
|
||||
dc.DrawRectangle(brush, null, new Rect(paddingX + (sensor.X - sz / 2) * factor, paddingY + (sensor.Y - sz / 2) * factor, sz * factor, sz * factor));
|
||||
var x = paddingX + (sensor.X - sz / 2) * factor;
|
||||
var y = paddingY + (sensor.Y - sz / 2) * factor;
|
||||
|
||||
dc.DrawRectangle(brush, null, new Rect(x, y, sz * factor, sz * factor));
|
||||
|
||||
/*
|
||||
// draw sensor id for debug
|
||||
var type = new Typeface("Microsoft YaHei");
|
||||
dc.DrawText(new FormattedText(sensor.Id.ToString(),
|
||||
CultureInfo.CurrentCulture, FlowDirection.LeftToRight, type, 12, Brushes.White, 96),
|
||||
new Point(x, y));
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace chuni_hands {
|
|||
public bool Active { get; private set; }
|
||||
public bool StateChanged { get; private set; }
|
||||
public int Size => _config.SensorSize;
|
||||
public int Id => _id;
|
||||
|
||||
private Mat _startValue;
|
||||
private readonly Config _config;
|
||||
|
@ -31,7 +32,7 @@ namespace chuni_hands {
|
|||
X = _config.CaptureWidth / 2 + _config.OffsetX;
|
||||
X = Math.Max(Math.Min(X, _config.CaptureWidth - _config.SensorSize), _config.SensorSize);
|
||||
|
||||
Y = _config.CaptureHeight / 2 + _config.OffsetY + (_id - 3) * _config.Distance;
|
||||
Y = _config.CaptureHeight - (_config.CaptureHeight / 2 + _config.OffsetY + _id * _config.Distance);
|
||||
Y = Math.Max(Math.Min(Y, _config.CaptureHeight - _config.SensorSize), _config.SensorSize);
|
||||
|
||||
// check area
|
||||
|
|
Loading…
Reference in New Issue