コード例 #1
0
        static void ImgListHandler_AllImgProcessed(object sender, AllImgProcessedEventArgs args)
        {
            var angleDisplay = new StringBuilder();

            foreach (var radianangle in args.ClickInputs.Angles)
            {
                angleDisplay.Append(string.Format("Rotated by: {0} degrees \n", Math.Round(radianangle * 180.0 / Math.PI, 2)));
            }
            MessageBox.Show(angleDisplay.ToString());

            //Serialize object
            var serializer        = new XmlSerializer(typeof(ClickInputs));
            var outputXmlFilePath = ExecutionDirInfoHelper.CreateUniqueOutputPath() + @"\ClickInputs.xml";
            var tw = new StreamWriter(outputXmlFilePath);

            serializer.Serialize(tw, args);
            tw.Close();

            //Test deserialization
            serializer = new XmlSerializer(typeof(ClickInputs));
            var tr           = new StreamReader(outputXmlFilePath);
            var deserialized = (ClickInputs)serializer.Deserialize(tr);

            if (deserialized.Angles.Length != args.ClickInputs.Angles.Length)
            {
                throw new Exception("Not properly deserialized");
            }
            tr.Close();
        }
コード例 #2
0
        public void TestModelCreationForDinosaur()
        {
            var imageFolder = string.Format(@"{0}\{1}", ExecutionDirInfoHelper.GetInputDirPath(), "dinosaur");
            var outputFolder = ExecutionDirInfoHelper.CreateUniqueOutputPath();

            var contract = new CreateModelContract
            {
                VariationIn3DCoordinates = 5.0f,
                //todo: this wont work AllImgProcessedEventArgs1 uses an old class which will fail deserialization
                ClickInputs = MainProcessor.GetClickInputsFromFile(imageFolder + @"\AllImgProcessedEventArgs.xml"),
                InvalidColor = System.Drawing.Color.FromArgb(1, 200, 200, 200),
                ImageFolder = imageFolder,
                BackgroundStrippingParams = new BackgroundStrippingParams
                {
                    ScreenBasedParams = new ScreenBasedParams
                    {
                        MaxDiffPercent = 99,
                        MinColorOffset = 25,
                        ScreenColorTypes = ScreenColorTypes.BlueScreen
                    }
                },
                SmoothingIterationCount = 2,
                LogFilePath = outputFolder + @"\Log.txt",
                PtDensity = 200
            };
            var modelMeshAndTexture = MainProcessor.CreateDefaultModel(contract);

            XamlWriter.SaveMeshGeometryModel(outputFolder + @"\model.xaml", modelMeshAndTexture.MeshGeometry, modelMeshAndTexture.TextureBitmap);
        }
コード例 #3
0
 public void SetUp()
 {
     _inputFilePath  = ExecutionDirInfoHelper.GetInputDirPath();
     _outputFilePath = ExecutionDirInfoHelper.CreateUniqueOutputPath();
 }