コード例 #1
0
		protected override Config OnConfigure(Config defaultConfig, Config[] existingConfigs) {
			foreach (var item in defaultConfig.parameters.elementItem) {
				if (item.name == "AntishakerCrop") {
					item.any = new synesis.AntishakerCrop() {
						XOffs = -1, YOffs = 1, CropWidth = 2, CropHeight = 2
					}.Serialize();
				} else if (item.name == "UserRegion") {
					var rose = new synesis.Rose() { Left = true, UpLeft = true, Up = true, UpRight = true, Right = true, DownRight = true, Down = true, DownLeft = true };
					var points = new [] {
                     new synesis.Point() { X=-1,Y=-1 },
                     new synesis.Point() { X=-1,Y=1},
                     new synesis.Point() { X=1,Y=1 },
                     new synesis.Point() { X=1,Y=-1 }
               };
					item.any = new synesis.UserRegion() {
						Rose = rose, Points = points
					}.Serialize();
				} else if (item.name == "MarkerCalibration") {
					var heightMarker = new synesis.HeightMarker() {
						Height = 170,
						SurfaceNormals = new synesis.SurfaceNormal[] 
                        { 
                            new synesis.SurfaceNormal() { Height=0.4f, Point = new synesis.Point() {X=-0.5f,Y=-0.25f} } ,
                            new synesis.SurfaceNormal() { Height = 0.25f, Point = new synesis.Point() { X = 0.5f, Y = 0.5f } }
                        }
					};
					var heightMarkers = new synesis.HeightMarker[] { heightMarker };
					var heightMarkerCalibration = new synesis.HeightMarkerCalibration() { FocalLength = 9, MatrixFormat = synesis.MatrixFormat.Item13, HeightMarkers = heightMarkers };
					item.any = new synesis.MarkerCalibration() { Item = heightMarkerCalibration }.Serialize();
				}
			}

			foreach (var item in defaultConfig.parameters.simpleItem) {
				switch (item.name) {
					case "UseObjectTracker":
					item.value = DataConverter.BoolToString(true); break;
					case "StabilizationTime":
					item.value = DataConverter.IntToString(1000); break;
					case "MinObjectArea":
					item.value = DataConverter.FloatToString(0.1f); break;
					case "MaxObjectArea":
					item.value = DataConverter.FloatToString(10.0f); break;
					case "MaxObjectSpeed":
					item.value = DataConverter.FloatToString(20.0f); break;
					case "DisplacementSensitivity":
					item.value = DataConverter.IntToString(3); break;
					case "UseAntishaker":
					item.value = DataConverter.BoolToString(true); break;
					case "ContrastSensitivity":
					item.value = DataConverter.IntToString(7); break;
					case "ImageTooDark":
					item.value = DataConverter.BoolToString(true); break;
					case "ImageTooBlurry":
					item.value = DataConverter.BoolToString(true); break;
					case "ImageTooBright":
					item.value = DataConverter.BoolToString(true); break;
					case "CameraRedirected":
					item.value = DataConverter.BoolToString(true); break;
					case "CameraObstructed":
					item.value = DataConverter.BoolToString(true); break;
				}
			}





			return defaultConfig;
		}
コード例 #2
0
        void GetData()
        {
            if (markerMode == MarkerMode.M1D)
            {
                //1d
                synesis.HeightMarkerCalibration hmarker = new synesis.HeightMarkerCalibration();
                hmarker.MatrixFormat = calibrationMarkers.MatrixFormat.mformat;
                hmarker.FocalLength  = calibrationMarkers.FocalLength;
                List <synesis.HeightMarker>  hmarkerslist = new List <synesis.HeightMarker>();
                synesis.HeightMarker         hmark        = new synesis.HeightMarker();
                List <synesis.SurfaceNormal> snormals     = new List <synesis.SurfaceNormal>();

                synesis.SurfaceNormal normal = new synesis.SurfaceNormal();
                normal.Point = new synesis.Point()
                {
                    X = (int)calibrationMarkers.UnitedMarker1.Top.X,
                    Y = (int)calibrationMarkers.UnitedMarker1.Top.Y
                };
                normal.Height = (int)Math.Abs(calibrationMarkers.UnitedMarker1.Bottom.Y - calibrationMarkers.UnitedMarker1.Top.Y);
                snormals.Add(normal);

                normal       = new synesis.SurfaceNormal();
                normal.Point = new synesis.Point()
                {
                    X = (int)calibrationMarkers.UnitedMarker2.Top.X,
                    Y = (int)calibrationMarkers.UnitedMarker2.Top.Y
                };
                normal.Height = (int)Math.Abs(calibrationMarkers.UnitedMarker2.Bottom.Y - calibrationMarkers.UnitedMarker2.Top.Y);
                snormals.Add(normal);

                hmark.SurfaceNormals = snormals.ToArray();

                hmark.Height = calibrationMarkers.PhysicalHeight;

                hmarkerslist.Add(hmark);

                hmarker.HeightMarkers = hmarkerslist.ToArray();

                model.Markers.Item = hmarker;
            }
            else
            {
                synesis.CombinedMarkerCalibration cmarker = new synesis.CombinedMarkerCalibration();

                List <synesis.CombinedMarker> cmarkerslist = new List <synesis.CombinedMarker>();
                synesis.CombinedMarker        cmark        = new synesis.CombinedMarker();
                List <synesis.Rect>           srects       = new List <synesis.Rect>();

                synesis.Rect rect = new synesis.Rect();
                rect.LeftTop = new synesis.Point()
                {
                    X = (int)calibrationMarkers.UnitedMarker1.TopLeft.X,
                    Y = (int)calibrationMarkers.UnitedMarker1.TopLeft.Y
                };
                rect.RightBottom = new synesis.Point()
                {
                    X = (int)calibrationMarkers.UnitedMarker1.BottomRight.X,
                    Y = (int)calibrationMarkers.UnitedMarker1.BottomRight.Y
                };
                srects.Add(rect);

                rect         = new synesis.Rect();
                rect.LeftTop = new synesis.Point()
                {
                    X = (int)calibrationMarkers.UnitedMarker2.TopLeft.X,
                    Y = (int)calibrationMarkers.UnitedMarker2.TopLeft.Y
                };
                rect.RightBottom = new synesis.Point()
                {
                    X = (int)calibrationMarkers.UnitedMarker2.BottomRight.X,
                    Y = (int)calibrationMarkers.UnitedMarker2.BottomRight.Y
                };
                srects.Add(rect);

                cmark.Rectangles = srects.ToArray();

                cmark.Height = calibrationMarkers.PhysicalHeight;
                cmark.Width  = calibrationMarkers.PhysicalWidth;

                cmarkerslist.Add(cmark);

                cmarker.CombinedMarkers = cmarkerslist.ToArray();

                model.Markers.Item = cmarker;
            }
        }
コード例 #3
0
        void GetData() {
            if (markerMode == MarkerMode.M1D) {
                //1d
                synesis.HeightMarkerCalibration hmarker = new synesis.HeightMarkerCalibration();
                hmarker.MatrixFormat = calibrationMarkers.MatrixFormat.mformat;
                hmarker.FocalLength = calibrationMarkers.FocalLength;
                List<synesis.HeightMarker> hmarkerslist = new List<synesis.HeightMarker>();
                synesis.HeightMarker hmark = new synesis.HeightMarker();
                List<synesis.SurfaceNormal> snormals = new List<synesis.SurfaceNormal>();
                
                synesis.SurfaceNormal normal = new synesis.SurfaceNormal();
                normal.Point = new synesis.Point() { 
                    X = (int)calibrationMarkers.UnitedMarker1.Top.X, 
                    Y = (int)calibrationMarkers.UnitedMarker1.Top.Y };
                normal.Height = (int)Math.Abs(calibrationMarkers.UnitedMarker1.Bottom.Y - calibrationMarkers.UnitedMarker1.Top.Y);
                snormals.Add(normal);
                
                normal = new synesis.SurfaceNormal();
                normal.Point = new synesis.Point() {
                    X = (int)calibrationMarkers.UnitedMarker2.Top.X,
                    Y = (int)calibrationMarkers.UnitedMarker2.Top.Y
                };
                normal.Height = (int)Math.Abs(calibrationMarkers.UnitedMarker2.Bottom.Y - calibrationMarkers.UnitedMarker2.Top.Y);
                snormals.Add(normal);

                hmark.SurfaceNormals = snormals.ToArray();

                hmark.Height = calibrationMarkers.PhysicalHeight;

                hmarkerslist.Add(hmark);
                
                hmarker.HeightMarkers = hmarkerslist.ToArray();
                
                model.Markers.Item = hmarker;
            } else {
                synesis.CombinedMarkerCalibration cmarker = new synesis.CombinedMarkerCalibration();

                List<synesis.CombinedMarker> cmarkerslist = new List<synesis.CombinedMarker>();
                synesis.CombinedMarker cmark = new synesis.CombinedMarker();
                List<synesis.Rect> srects = new List<synesis.Rect>();

                synesis.Rect rect = new synesis.Rect();
                rect.LeftTop = new synesis.Point() {
                    X = (int)calibrationMarkers.UnitedMarker1.TopLeft.X,
                    Y = (int)calibrationMarkers.UnitedMarker1.TopLeft.Y
                };
                rect.RightBottom = new synesis.Point() {
                    X = (int)calibrationMarkers.UnitedMarker1.BottomRight.X,
                    Y = (int)calibrationMarkers.UnitedMarker1.BottomRight.Y
                };
                srects.Add(rect);

                rect = new synesis.Rect();
                rect.LeftTop = new synesis.Point() {
                    X = (int)calibrationMarkers.UnitedMarker2.TopLeft.X,
                    Y = (int)calibrationMarkers.UnitedMarker2.TopLeft.Y
                };
                rect.RightBottom = new synesis.Point() {
                    X = (int)calibrationMarkers.UnitedMarker2.BottomRight.X,
                    Y = (int)calibrationMarkers.UnitedMarker2.BottomRight.Y
                };
                srects.Add(rect);

                cmark.Rectangles = srects.ToArray();

                cmark.Height = calibrationMarkers.PhysicalHeight;
                cmark.Width = calibrationMarkers.PhysicalWidth;

                cmarkerslist.Add(cmark);

                cmarker.CombinedMarkers = cmarkerslist.ToArray();

                model.Markers.Item = cmarker;
            }
        }
コード例 #4
0
        protected override Config OnConfigure(Config defaultConfig, Config[] existingConfigs)
        {
            foreach (var item in defaultConfig.parameters.elementItem)
            {
                if (item.name == "AntishakerCrop")
                {
                    item.any = new synesis.AntishakerCrop()
                    {
                        XOffs = -1, YOffs = 1, CropWidth = 2, CropHeight = 2
                    }.Serialize();
                }
                else if (item.name == "UserRegion")
                {
                    var rose = new synesis.Rose()
                    {
                        Left = true, UpLeft = true, Up = true, UpRight = true, Right = true, DownRight = true, Down = true, DownLeft = true
                    };
                    var points = new [] {
                        new synesis.Point()
                        {
                            X = -1, Y = -1
                        },
                        new synesis.Point()
                        {
                            X = -1, Y = 1
                        },
                        new synesis.Point()
                        {
                            X = 1, Y = 1
                        },
                        new synesis.Point()
                        {
                            X = 1, Y = -1
                        }
                    };
                    item.any = new synesis.UserRegion()
                    {
                        Rose = rose, Points = points
                    }.Serialize();
                }
                else if (item.name == "MarkerCalibration")
                {
                    var heightMarker = new synesis.HeightMarker()
                    {
                        Height         = 170,
                        SurfaceNormals = new synesis.SurfaceNormal[]
                        {
                            new synesis.SurfaceNormal()
                            {
                                Height = 0.4f, Point = new synesis.Point()
                                {
                                    X = -0.5f, Y = -0.25f
                                }
                            },
                            new synesis.SurfaceNormal()
                            {
                                Height = 0.25f, Point = new synesis.Point()
                                {
                                    X = 0.5f, Y = 0.5f
                                }
                            }
                        }
                    };
                    var heightMarkers           = new synesis.HeightMarker[] { heightMarker };
                    var heightMarkerCalibration = new synesis.HeightMarkerCalibration()
                    {
                        FocalLength = 9, MatrixFormat = synesis.MatrixFormat.Item13, HeightMarkers = heightMarkers
                    };
                    item.any = new synesis.MarkerCalibration()
                    {
                        Item = heightMarkerCalibration
                    }.Serialize();
                }
            }

            foreach (var item in defaultConfig.parameters.simpleItem)
            {
                switch (item.name)
                {
                case "UseObjectTracker":
                    item.value = DataConverter.BoolToString(true); break;

                case "StabilizationTime":
                    item.value = DataConverter.IntToString(1000); break;

                case "MinObjectArea":
                    item.value = DataConverter.FloatToString(0.1f); break;

                case "MaxObjectArea":
                    item.value = DataConverter.FloatToString(10.0f); break;

                case "MaxObjectSpeed":
                    item.value = DataConverter.FloatToString(20.0f); break;

                case "DisplacementSensitivity":
                    item.value = DataConverter.IntToString(3); break;

                case "UseAntishaker":
                    item.value = DataConverter.BoolToString(true); break;

                case "ContrastSensitivity":
                    item.value = DataConverter.IntToString(7); break;

                case "ImageTooDark":
                    item.value = DataConverter.BoolToString(true); break;

                case "ImageTooBlurry":
                    item.value = DataConverter.BoolToString(true); break;

                case "ImageTooBright":
                    item.value = DataConverter.BoolToString(true); break;

                case "CameraRedirected":
                    item.value = DataConverter.BoolToString(true); break;

                case "CameraObstructed":
                    item.value = DataConverter.BoolToString(true); break;
                }
            }



            return(defaultConfig);
        }