Camera Information System
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.
 
 
 
 

80 lines
1.8 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.VideoWidth;
_cameraCalcInfo.MinFocusY = 1781.4 / _cameraCalcInfo.VideoHeight;
}
#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 int HexToDecMa(double wHex)
{
int wHexInt = wHex.ToInt();
int ret = (wHexInt / 4096) * 1000 + ((wHexInt % 4096) / 256) * 100 + ((wHexInt % 256) / 16) * 10 + (wHexInt % 16);
return ret;
}
#endregion Util
}