You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.7 KiB
77 lines
1.7 KiB
using System.Drawing;
|
|
|
|
namespace Cis.Application.Core;
|
|
|
|
public class HikMarkSeacher : MarkSearcherBase
|
|
{
|
|
public HikMarkSeacher(CameraCalcInfo cameraCalcInfo) : base(cameraCalcInfo)
|
|
{
|
|
}
|
|
|
|
#region Implement
|
|
|
|
protected override double ConvertPanPosToAngle(double panPos)
|
|
{
|
|
double ret = (0.1 * HexToDecMa(panPos)) / (180 * Math.PI);
|
|
ret = (ret >= 0) ? ret : (2 * Math.PI + ret);
|
|
return ret;
|
|
}
|
|
|
|
protected override double ConvertTiltPosToAngle(double tiltPos, double tiltMinPos = 0)
|
|
{
|
|
double ndiff;
|
|
if (tiltPos > tiltMinPos)
|
|
ndiff = HexToDecMa(tiltPos) - HexToDecMa(tiltMinPos);
|
|
else
|
|
ndiff = HexToDecMa(tiltPos) + HexToDecMa(13824) - HexToDecMa(tiltMinPos);
|
|
double ret = (0.1 * ndiff) / (180 * Math.PI);
|
|
return ret;
|
|
}
|
|
|
|
protected override PointF GetFOfMatrixByZoomPos(double zoomPos)
|
|
{
|
|
PointF pointF = new()
|
|
{
|
|
X = (float)GetFx(zoomPos),
|
|
Y = (float)GetFy(zoomPos)
|
|
};
|
|
return pointF;
|
|
}
|
|
|
|
protected override void CalcSensor()
|
|
{
|
|
_cameraCalcInfo.MinFocusX = 1783.6 / _cameraCalcInfo.ImageWidth;
|
|
_cameraCalcInfo.MinFocusY = 1781.4 / _cameraCalcInfo.ImageHeight;
|
|
}
|
|
|
|
#endregion Implement
|
|
|
|
#region Util
|
|
|
|
protected virtual double GetFx(double zoomPos)
|
|
{
|
|
CameraCalcInfo calcInfo = _cameraCalcInfo;
|
|
return calcInfo.MinFocusX * GetZoomTag(zoomPos);
|
|
}
|
|
|
|
protected virtual double GetFy(double zoomPos)
|
|
{
|
|
CameraCalcInfo calcInfo = _cameraCalcInfo;
|
|
return calcInfo.MinFocusY * GetZoomTag(zoomPos);
|
|
}
|
|
|
|
protected virtual double GetZoomTag(double zoomPos)
|
|
{
|
|
double ret = HexToDecMa(zoomPos) * 0.1;
|
|
ret = (ret - 1) * 0.65 + 1;
|
|
return ret;
|
|
}
|
|
|
|
protected double HexToDecMa(double wHex)
|
|
{
|
|
double ret = (wHex / 4096) * 1000 + ((wHex % 4096) / 256) * 100 + ((wHex % 256) / 16) * 10 + (wHex % 16);
|
|
return ret;
|
|
}
|
|
|
|
#endregion Util
|
|
}
|