Rect FromSynesisAntishaker(synesis.AntishakerCrop rct) { Rect srct = new Rect(); srct.X = rct.XOffs; srct.Y = rct.YOffs; srct.Width = rct.CropWidth; srct.Height = rct.CropHeight; if (srct.Width == 0) srct.Width = 10; if (srct.Height == 0) srct.Height = 10; if (srct.X == 0) srct.X = 1; if (srct.Y == 0) srct.Y = 1; return srct; }
public UnitedMarkerCalibration(synesis.HeightMarkerCalibration hCalibration) { Init(hCalibration); }
void Init(synesis.HeightMarkerCalibration hCalibration) { FocalLength = hCalibration.FocalLength; MatrixFormat = new MatrixValue(hCalibration.MatrixFormat); if (hCalibration.HeightMarkers.Count() != 1) return; physicalHeight = hCalibration.HeightMarkers[0].Height; physicalWidth = physicalHeight; if (hCalibration.HeightMarkers[0].SurfaceNormals.Count() != 2) return; unitedMarker1 = new UnitedMarker(hCalibration.HeightMarkers[0].SurfaceNormals[0], 1); unitedMarker2 = new UnitedMarker(hCalibration.HeightMarkers[0].SurfaceNormals[1], 2); }
public UnitedMarkerCalibration(synesis.MarkerCalibration mk) { var retHm = mk.Item as synesis.HeightMarkerCalibration; if (retHm != null) { Init(retHm); return; } var retCm = mk.Item as synesis.CombinedMarkerCalibration; if (retCm != null) { Init(retCm); return; } }
public UnitedMarker(synesis.SurfaceNormal hmarker, int ID) { this.ID = ID; Top = new OPoint() { X = hmarker.Point.X, Y = hmarker.Point.Y }; Bottom = new OPoint() { X = top.X, Y = top.Y + hmarker.Height }; FlashFor2D(); }
public UnitedMarker(synesis.Rect cmarker, int ID) { this.ID = ID; TopLeft = new OPoint() { X = cmarker.LeftTop.X, Y = cmarker.LeftTop.Y }; BottomRight = new OPoint() { X = cmarker.RightBottom.X, Y = cmarker.RightBottom.Y }; FlashFor1D(); }
public static Point SynesisToPoint(synesis.Point pt) { return new Point(pt.X, pt.Y); }
void ScalePointsOutput(synesis.TripWirePoints points) { DataConverter.ScalePointOutput(points.P1, videoSourceSize, videoEncoderSize); DataConverter.ScalePointOutput(points.P2, videoSourceSize, videoEncoderSize); }
void ScaleUserRegionOutput(synesis.UserRegion uregion) { uregion.Points.ForEach(x => { DataConverter.ScalePointOutput(x, videoSourceSize, videoEncoderSize); }); }
void ScaleRectInput(synesis.Rect rect) { DataConverter.ScalePointInput(rect.LeftTop, videoSourceSize, videoEncoderSize); DataConverter.ScalePointInput(rect.RightBottom, videoSourceSize, videoEncoderSize); }
void ScaleMarkersInput(synesis.MarkerCalibration markers) { var cmarkerCalibration = markers.Item as synesis.CombinedMarkerCalibration; if (cmarkerCalibration != null) { //2d cmarkerCalibration.CombinedMarkers.ForEach(cm => { cm.Rectangles.ForEach(rect => { ScaleRectInput(rect); }); }); } else { //1d var hmarkerCalibration = markers.Item as synesis.HeightMarkerCalibration; hmarkerCalibration.HeightMarkers.ForEach(hm => { hm.SurfaceNormals.ForEach(sn => { DataConverter.ScalePointInput(sn.Point, videoSourceSize, videoEncoderSize); sn.Height = ScaleHeigthInput(sn.Height); }); }); } }
void ScaleAntishakerCropInput(synesis.AntishakerCrop crop) { //scale from [-1;1] to visible dimensions double valueX = (videoDescr.videoSourceResolution.Width / 2) * (crop.XOffs + 1); double valueY = videoDescr.videoSourceResolution.Height - (videoDescr.videoSourceResolution.Height / 2) * (crop.YOffs + 1); double width = (videoDescr.videoSourceResolution.Width / 2) * (crop.CropWidth); double height = (videoDescr.videoSourceResolution.Height / 2) * (crop.CropHeight); //convert ftrom video sourve resolution to encoder resolution double scalex = videoDescr.videoInfo.Resolution.Width / (videoDescr.videoSourceResolution.Width == 0 ? 1 : videoDescr.videoSourceResolution.Width); double scaley = videoDescr.videoInfo.Resolution.Height / (videoDescr.videoSourceResolution.Height == 0 ? 1 : videoDescr.videoSourceResolution.Height); valueX = valueX * scalex; valueY = valueY * scaley; height = height * scaley; width = width * scalex; crop.XOffs = (float)valueX; crop.YOffs = (float)valueY; crop.CropHeight = (float)height; crop.CropWidth = (float)width; }
void ScaleAntishakerCropOutput(synesis.AntishakerCrop crop) { double valueX = crop.XOffs; double valueY = crop.YOffs; double width = crop.CropWidth; double height = crop.CropHeight; //convert from video sourve resolution to encoder resolution double scalex = videoDescr.videoSourceResolution.Width / videoDescr.videoInfo.Resolution.Width; double scaley = videoDescr.videoSourceResolution.Height / videoDescr.videoInfo.Resolution.Height; valueX = valueX * scalex; valueY = valueY * scaley; height = height * scaley; width = width * scalex; //scale from visible to [-1;1] double heightValue = videoDescr.videoSourceResolution.Height - 1; double widthValue = videoDescr.videoSourceResolution.Width - 1; crop.XOffs = (float)(((valueX * 2) / widthValue) - 1); crop.YOffs = (float)((((heightValue - valueY) * 2) / heightValue) - 1); crop.CropWidth = (float)((width * 2) / widthValue); crop.CropHeight = (float)((height * 2) / heightValue); }
public static void ScalePointOutput(synesis.Point point, Size videoSourceSize, Size videoEncoderSize) { double valueX = point.X; double valueY = point.Y; //convert ftrom video sourve resolution to encoder resolution double scalex = videoSourceSize.Width / (videoEncoderSize.Width == 0 ? 1 : videoEncoderSize.Width); double scaley = videoSourceSize.Height / (videoEncoderSize.Height == 0 ? 1 : videoEncoderSize.Height); valueX = valueX * scalex; valueY = valueY * scaley; //scale from visible to [-1;1] double heightValue = videoSourceSize.Height - 1; heightValue = heightValue == 0 ? 1 : heightValue; double widthValue = videoSourceSize.Width - 1; widthValue = widthValue == 0 ? 1 : widthValue; point.X = (float)(((valueX * 2) / widthValue) - 1); point.Y = (float)((((heightValue - valueY) * 2) / heightValue) - 1); }
void Init(synesis.CombinedMarkerCalibration cCalibration) { matrixFormat = new MatrixValue(synesis.MatrixFormat.Item1); if (cCalibration.CombinedMarkers.Count() != 1) return; physicalHeight = cCalibration.CombinedMarkers[0].Height; physicalWidth = cCalibration.CombinedMarkers[0].Width; if (cCalibration.CombinedMarkers[0].Rectangles.Count() != 2) return; unitedMarker1 = new UnitedMarker(cCalibration.CombinedMarkers[0].Rectangles[0], 1); unitedMarker2 = new UnitedMarker(cCalibration.CombinedMarkers[0].Rectangles[1], 2); }
public MatrixValue(synesis.MatrixFormat mformat) { this.mformat = mformat; this.name = matrixTable[mformat]; }
public UnitedMarkerCalibration(synesis.CombinedMarkerCalibration cCalibration) { Init(cCalibration); }
public void SetSynesisPoint(synesis.Point spt) { point = new Point(spt.X, spt.Y); }
void ScalePointsOutput(synesis.RegionPoints points) { points.Points.ForEach(x => { DataConverter.ScalePointOutput(x, videoSourceSize, videoEncoderSize); }); }
public static void ScalePointInput(synesis.Point point, Size videoSourceSize, Size videoEncoderSize) { //scale from [-1;1] to visible dimensions double valueX = (videoSourceSize.Width / 2) * (point.X + 1); double valueY = videoSourceSize.Height - (videoSourceSize.Height / 2) * (point.Y + 1); //convert ftrom video sourve resolution to encoder resolution double scalex = videoEncoderSize.Width / (videoSourceSize.Width == 0 ? 1 : videoSourceSize.Width); double scaley = videoEncoderSize.Height / (videoSourceSize.Height == 0 ? 1 : videoSourceSize.Height); valueX = valueX * scalex; valueY = valueY * scaley; point.X = (float)valueX; point.Y = (float)valueY; }