コード例 #1
0
        static void Main(string[] args)
        {
            Logger.InitializeTelemetryClient(Settings.Loaded.ApplicationInsightsInstrumentationKey);

            try
            {
                HttpUtils.DefaultConnectionLimit = 8;

                var mainProcessor = new MainProcessor(
                    Settings.Loaded.ApplicationClientInfo,
                    Settings.Loaded.StorageAccountInfo,
                    Settings.Loaded.TsidCheckpointingTableName,
                    Settings.Loaded.StationObservationsCheckpointingPartitionKey,
                    Settings.Loaded.EventHubConnectionString,
                    Settings.Loaded.AzureMapsSubscriptionKey,
                    Settings.Loaded.AzureMapsCacheTableName,
                    Settings.Loaded.TsiEnvironmentFqdn);

                // mainProcessor.Run().Wait();
                // mainProcessor.ReloadStationsAndUpdateTsmAsync().Wait(); // test TSM generation without pulling data
                mainProcessor.LoadStationsAndGenerateReferenceDataJsonAsync("referenceData.json").Wait(); // generate ref data without pulling data
            }
            catch (Exception e)
            {
                Logger.TraceException("Main", e);
                throw;
            }
            finally
            {
                Logger.Flush();
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            IUserSource   userSource    = new AdUserSource();
            MainProcessor mainProcessor = new MainProcessor(userSource);

            mainProcessor.Process();
        }
コード例 #3
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);
        }
コード例 #4
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            MainProcessor main = (MainProcessor)e.Argument;

            main.ProgressChanged += SetProgress;
            main.startProcessing();
        }
コード例 #5
0
 public object POST(MainProcessorOperation request)
 {
     if (request.Operation.ToUpper() == "STOP")
     {
         if (MainProcessor.IsRunning == false)
         {
             return(new MainProcessorResponse {
                 Result = $"Processor Is Not Running!"
             });
         }
         MainProcessor.Stop();
         return(new MainProcessorResponse {
             Result = $"Processor Stopped!"
         });
     }
     else if (request.Operation.ToUpper() == "START")
     {
         if (MainProcessor.IsRunning == true)
         {
             return(new MainProcessorResponse {
                 Result = $"Processor Has been already Runned!"
             });
         }
         MainProcessor.Start();
         return(new MainProcessorResponse {
             Result = $"Processor Started!"
         });
     }
     return(new MainProcessorResponse {
         Result = $"Invalid Operation!"
     });
 }
コード例 #6
0
ファイル: TestHelper.cs プロジェクト: caidongyun/ibmodeler3
        private static Bitmap GetStrippedImage(string filePath)
        {
            var image           = (Bitmap)Image.FromFile(filePath);
            var strippingParams = GetScreenBasedParamsForFirstMarioImage();

            MainProcessor.StripBackground(image, strippingParams);
            return(image);
        }
コード例 #7
0
        static void Main(string[] args)
        {
            string outputPath = "C:/Users/Alana/Desktop/Scraper.csv";
            string url        = "https://www.commercialrealestate.com.au/business-for-sale/melbourne-region-vic/medical/";
            var    processor  = new MainProcessor();

            processor.Process(outputPath, url);
        }
コード例 #8
0
        private static void BwDoWork(object sender, DoWorkEventArgs e)
        {
            var contract = (CreateMeshContract)e.Argument;
            var logger   = new Logger(contract.LogFilePath);

            var angles = contract.ClickInputs.Angles;

            if (CheckCancellation(e))
            {
                return;
            }

            contract.PercentExtraWidth = MainProcessor.GetExtraPadding(contract);

            if (CheckCancellation(e))
            {
                return;
            }

            Stream moldDataPtr = null;

            for (var index = 0; index < angles.Length; index++)
            {
                var angleInDegrees = angles[index] * 180.0 / Math.PI;
                if (angleInDegrees <= contract.MaxAngleOfImageToProcessInDegress)
                {
                    CreateMeshProcessor.ApplyImage(contract, index, ref moldDataPtr, logger);
                    if (CheckCancellation(e))
                    {
                        return;
                    }
                    _bw.ReportProgress(index);
                }
            }

            if (CheckCancellation(e))
            {
                return;
            }

            _bw.ReportProgress(angles.Length + 1);
            e.Result = CreateMeshProcessor.CreateModelFromMold(contract.PtDensity, moldDataPtr, logger);

            //clean up
            if (moldDataPtr != null)
            {
                moldDataPtr.Dispose();
            }
            if (MainProcessor.FirstImageParams != null)
            {
                MainProcessor.FirstImageParams.Dispose();
            }
        }
コード例 #9
0
        private MainProcessor getMainProcessor()
        {
            logger.ConfigureLogging();
            msiEditor.Logger = logger;
            adm.Logger       = logger;
            creator.Logger   = logger;

            ProjectInfo proj = new ProjectInfo("", "", pimsIdTextBox.Text, appNameTextBox.Text, appVerTextBox.Text, pkgNameTextBox.Text, pkgVerTextBox.Text,
                                               String.Format("{0}, {1}", pkgrNameTextBox.Text, "DXC"), "", "", String.Format("{0}_{1}_{2}", "BMW", pkgNameTextBox.Text, pkgVerTextBox.Text),
                                               "", Is32bit(), IsCustomMsi(), editMstCheckBox.Checked, fileLocationMstTextBox1.Text, editMsiCheckBox.Checked);

            if (proj.isCustomMsi)
            {
                proj.FolderPath = "";
                proj.MsiName    = "";
            }
            else if (!proj.isEditMst && !proj.isCustomMsi && !proj.isEditMsi)
            {
                proj.FolderPath = Path.GetDirectoryName(_fullMsiPath) + "\\";
                proj.MsiName    = Path.GetFileNameWithoutExtension(_fullMsiPath);
            }
            else if (proj.isEditMsi)
            {
                proj.FolderPath = Path.GetDirectoryName(_fullMsiPath) + "\\";
                proj.MsiName    = String.Format("{0}_{1}", proj.PkgName, proj.PkgVer);
            }
            else
            {
                proj.FolderPath  = Path.GetDirectoryName(_fullMsiPath) + "\\";
                proj.MsiName     = Path.GetFileNameWithoutExtension(_fullMsiPath);
                proj.EditMstPath = Path.GetFullPath(_fullMstPath);
            }

            string dateNow = DateTime.Now.ToString("d.M.yyyy");

            string[] pkgrNameArr = proj.AuthorName.Split(' ');
            char     first       = pkgrNameArr[0].ToCharArray()[0];
            char     second      = pkgrNameArr[1].ToCharArray()[0];

            proj.Comments = String.Format("{0}{1}, {2}, {3}", first.ToString().ToLowerInvariant(), second.ToString().ToLowerInvariant(), dateNow, "IS v23");

            adm.ProjectFolder = _projectFolder;
            adm.FullMsiPath   = _fullMsiPath;
            creator.Adm       = adm;
            creator.MsiEditor = msiEditor;

            MainProcessor main = new MainProcessor(msiEditor, adm, creator, logger, proj);

            return(main);
        }
コード例 #10
0
ファイル: Processor.cs プロジェクト: caidongyun/ibmodeler3
        /// <summary>
        /// load the image with necessary resizing and background stripping
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="inputParams"></param>
        /// <returns></returns>
        private static Bitmap GetProcessedImage(string filePath, AutoConfigureImgPointsParams inputParams)
        {
            Bitmap image;

            if (inputParams.ResizeWidth.HasValue && inputParams.ResizeHeight.HasValue)
            {
                image = MainProcessor.ResizeJpg(filePath, null, inputParams.ResizeWidth.Value, inputParams.ResizeHeight.Value);
            }
            else
            {
                image = (Bitmap)Image.FromFile(filePath);
            }
            MainProcessor.StripBackground(image, inputParams.BackgroundStrippingParams);
            return(image);
        }
コード例 #11
0
        private void createBtn_Click(object sender, EventArgs e)
        {
            if (!ValidateInput(false))
            {
                return;
            }

            enableControls(false);
            MainProcessor main = getMainProcessor();

            progressBar1.Value   = 0;
            progressBar1.Visible = true;
            progressBar1.Maximum = main.MaxProgressValue;
            backgroundWorker1.RunWorkerAsync(main);
        }
コード例 #12
0
        public void SetImage(string imagePath)
        {
            _bitmap = (Bitmap)Image.FromFile(imagePath);

            //resize to a base size so that it does not take too much time during test stripping
            var imageAlterationParams = new ImageAlterationParams
            {
                ResizeType = ResizeType.ResizeSufficiently
            };

            _bitmap = MainProcessor.ResizeImage(_bitmap, imageAlterationParams);

            var imageBrush = new ImageBrush(new BitmapImage(new Uri(imagePath, UriKind.Absolute)));

            SampleImageCanvas.Background = imageBrush;
        }
コード例 #13
0
        static void Main(string[] args)
        {
            MainProcessor processor = new MainProcessor();

            Console.WriteLine("processor starting.");
            processor.Start();
            Console.WriteLine("processor started.");

            Thread.Sleep(5 * 1000);

            Console.WriteLine("processor stopping.");
            processor.Stop();
            Console.WriteLine("processor stopped.");

            Console.Read();
        }
コード例 #14
0
        public void TestGetRotationAngleToRealignForNegativeAngle()
        {
            const string secondEndLower = @"\disc_second_end_lower.";
            var          clickInputs    = MainProcessor.GetClickInputsFromFile(_inputFolderPath + secondEndLower + "xml");

            var clickPositions = clickInputs.ImageClickInputDetailsList[0].ClickPositionListForImages;

            var result = ImageRotator.GetRotationAngleToRealign(clickPositions);

            Assert.IsTrue(result < 0);
            Assert.IsTrue(Math.Abs(Math.Abs(result) - 45) < 5);

            var inputImg = (Bitmap)Image.FromFile(_inputFolderPath + secondEndLower + "jpg");
            var rotated  = ImageRotator.RotateImg(inputImg, result, _bkColor);

            rotated.Save(_outputFolder + secondEndLower + "rotated.jpg");
        }
コード例 #15
0
        public void MainProcessor_Add()
        {
            IMainProcessor processor = new MainProcessor();

            Assert.AreEqual(0, processor.QueueLength);

            processor.Add("1");
            Assert.AreEqual(1, processor.QueueLength);
            while (processor.Processed == 0)
            {
                Thread.Yield();
            }

            Assert.AreEqual(0, processor.QueueLength);
            Assert.AreEqual(1, processor.Processed);
            Assert.AreEqual(ProcessStatusEnum.Done, processor.GetStatus("1").Status);
        }
コード例 #16
0
        public void ProcessImage(string imagePath, List <ClickPositionOnImage> copyPositions, double rotateImageBy, int currentImageNumber, int totalImageCount)
        {
            _leftEdgePositionBeforeRotation = new Point(0, 0);
            _rotationAngleToRealign         = rotateImageBy;

            _imageName = Path.GetFileName(imagePath);

            //the dimensions of the _currentImage and the image canvas should be the same so rotation will work right
            _currentImage = MainProcessor.ResizeJpg(imagePath, null, (int)ImageCanvas.Width, (int)ImageCanvas.Height);

            //rotate image if edges of disc are defined and a rotation angle is already specified
            if (copyPositions != null && copyPositions.Exists(x => x.PositionType == ClickPositionOnImageTypes.LeftEndOfRotatingDisc) &&
                copyPositions.Exists(x => x.PositionType == ClickPositionOnImageTypes.RightEndOfRotatingDisc) &&
                _rotationAngleToRealign > 0)
            {
                var rotatedImg = MainProcessor.RotateImg(_currentImage, (float)_rotationAngleToRealign, _bkColor);
                ImageCanvas.SetImage(rotatedImg);
            }
            else
            {
                ImageCanvas.SetImage(_currentImage);
            }

            ClickSequences = GetClickSequencesForFirstImage();
            if (copyPositions != null)
            {
                foreach (var copyPosition in copyPositions)
                {
                    CopyPositions(copyPosition);
                }
            }

            //do not ask for the bottom most part, if it is not the first image
            if (currentImageNumber > 1)
            {
                ClickSequences.Remove(ClickSequences.FirstOrDefault(x => x.PositionType == ClickPositionOnImageTypes.BottomMostPartOfModel));
            }

            SetNextClickPositionType();

            Status.Text = string.Format("Image {0} of {1}", currentImageNumber, totalImageCount);

            Previous.Visibility = currentImageNumber > 1? Visibility.Visible : Visibility.Hidden;
            Next.Content        = currentImageNumber == totalImageCount ? "Save" : "Next";
        }
コード例 #17
0
        private void AdjustSkin(object sender, RoutedEventArgs e)
        {
            if (_currentTextureType != TextureTypeEnum.FourCorners)
            {
                return;
            }

            var adjustSkinWindow = new AdjustSkin(_xCoodRangesFor4ImageTexture, _userXCoodRangesFor4ImageTexture);
            var result           = adjustSkinWindow.ShowDialog();

            if (!result.HasValue || !result.Value || adjustSkinWindow.ReturnValue == null)
            {
                return;
            }

            var returnValue = adjustSkinWindow.ReturnValue;

            if (_4CornerTextureAndBitmap == null)
            {
                return;
            }
            var indices = MainProcessor.GetIndicesFor4CornerTexture(_createMeshContract.ClickInputs.Angles);

            if (indices == null)
            {
                MessageBox.Show("Error in generating textures: Cannot identify photos for four corners.\nPlease check if photos are available for a full 360 degree view.");
                return;
            }

            var quickProcessingWindow = new QuickProcessingWindowHelper(ParentGrid);
            var add4CornerTexture     = MainProcessor.GetAddTextureInfoForIndexCollection(_createMeshContract, indices);

            if (add4CornerTexture.ImageInfos != null)
            {
                SetUserSuppliedLimit(0, add4CornerTexture, returnValue.FrontPhotoTexCoodValueLimits);
                SetUserSuppliedLimit(1, add4CornerTexture, returnValue.RightPhotoTexCoodValueLimits);
                SetUserSuppliedLimit(2, add4CornerTexture, returnValue.BackPhotoTexCoodValueLimits);
                SetUserSuppliedLimit(3, add4CornerTexture, returnValue.LeftPhotoTexCoodValueLimits);
            }
            _userXCoodRangesFor4ImageTexture = returnValue;

            _4CornerTextureAndBitmap = TextureProcessor.GenerateTexture(add4CornerTexture, (MeshGeometry3D)_currentModel.Geometry, "");
            quickProcessingWindow.Close();
            ApplyTextureOnCurrentModel(_4CornerTextureAndBitmap);
        }
コード例 #18
0
        private void Generate2CornerTexture()
        {
            if (_2CornerTextureAndBitmap != null)
            {
                return;
            }
            var quickProcessingWindow         = new QuickProcessingWindowHelper(ParentGrid);
            var addTextureInfoForFrontAndBack = MainProcessor.GetAddTextureInfoForFrontAndBackImage(_createMeshContract);

            if (addTextureInfoForFrontAndBack == null)
            {
                MessageBox.Show("Error in generating textures: Cannot identify front and back photos.\nPlease check if photos are available from front to back.");
                quickProcessingWindow.Close();
                return;
            }
            _2CornerTextureAndBitmap = TextureProcessor.GenerateTexture(addTextureInfoForFrontAndBack, (MeshGeometry3D)_currentModel.Geometry, "");
            quickProcessingWindow.Close();
        }
コード例 #19
0
        static void Main(string[] args)
        {
            var appHost = new AppHost();

            //Allow you to debug your Windows Service while you're deleloping it.
#if DEBUG
            Console.WriteLine("Running WinServiceAppHost in Console mode");
            try
            {
                appHost.Init();
                appHost.Start(ListeningOn);
                Process.Start(ListeningOn);
                MainProcessor.Start();
                Console.WriteLine("Press <CTRL>+C to stop.");
                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: {0}: {1}", ex.GetType().Name, ex.Message);
                throw;
            }
            finally
            {
                if (MainProcessor.IsRunning)
                {
                    MainProcessor.Stop();
                }
                appHost.Stop();
            }

            Console.WriteLine("WinServiceAppHost has finished");
#else
            //When in RELEASE mode it will run as a Windows Service with the code below

            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new WinService(appHost, ListeningOn)
            };
            ServiceBase.Run(ServicesToRun);
#endif

            Console.ReadLine();
        }
コード例 #20
0
        public MainViewModel()
        {
            notify = new NotificationDialogService();
            log    = new Log();

            CheckPowerStatusCommand = new RelayCommand <object>((p) => { return(true); }, (p) => {
                MainModel = MainProcessor.getPowerStatus();
            });
            GetHDDInfoCommand = new RelayCommand <object>((p) => { return(true); }, (p) => {
                hddCollection = MainProcessor.getHardDriveInfo();
            });
            CheckInternetCommand = new RelayCommand <object>((p) => { return(true); }, (p) => {
                MainModel.IsConnectedInternet = Helper.IsNetworkAvailable();
            });

            EnglishCommand = new RelayCommand <FrameworkElement>((e) => { return(true); }, (e) => {
                LocUtil.SwitchLanguage(e, "en-US");
                LanguageCollection = MainProcessor.getLanguages();
                LanguageWindow lw  = new LanguageWindow();
                lw.ShowDialog();
            });
            ChinaCommand = new RelayCommand <FrameworkElement>((e) => { return(true); }, (e) => {
                LocUtil.SwitchLanguage(e, "zh-CN");
                //AboutWindow aw = new AboutWindow();
                //aw.ShowDialog();
                var newNotification = new Notification()
                {
                    Title   = "Test Fail",
                    Message = "Test one Fail Please check your Machine Code and Try Again"
                              // ,ImgURL = "pack://application:,,,a/Resources/Images/warning.png"
                };
                var notificationConfiguration = NotificationConfiguration.DefaultConfiguration;
                notify.Show(newNotification, notificationConfiguration);
            });
            SaveLanguageCommand = new RelayCommand <object>((p) => { return(true); }, (p) => {
                MainProcessor.SaveLanguage(this.LanguageCollection);
            });

            //Log.Error("Test2", "Test2");
            //var lst = Log.GetListErrors();
            initData();
            //iup.UnInstall("{c166523c-fe0c-4a94-a586-f1a80cfbbf3e}");
        }
コード例 #21
0
        public void MainProcessor_Progress()
        {
            IMainProcessor processor = new MainProcessor();

            Assert.AreEqual(0, processor.QueueLength);

            processor.Add("1");
            processor.Add("2");
            processor.Add("3");
            processor.Add("4");
            processor.Add("5");

            bool exit;

            while (true)
            {
                exit = true;
                for (int i = 1; i < 6; i++)
                {
                    Thread.Yield();
                    if (processor.GetStatus(i.ToString()).Status != ProcessStatusEnum.Done)
                    {
                        exit = false;
                        break;
                    }
                }

                if (exit)
                {
                    break;
                }
            }


            for (int i = 1; i < 6; i++)
            {
                Assert.AreEqual(ProcessStatusEnum.Done, processor.GetStatus(i.ToString()).Status);
                Assert.AreNotEqual(0.0, processor.GetStatus(i.ToString()).Progress);
                Trace.WriteLine($"{i.ToString()} - {processor.GetStatus(i.ToString()).Progress.ToString()}");
            }

            Assert.AreEqual(5, processor.Processed);
        }
コード例 #22
0
        private static void RunTest(int minPixelsForBaseDisc, string filePath, string outputFileName)
        {
            var inputParams = new AutoConfigureImgPointsParams
            {
                BackgroundColor               = TestHelper.GetBackgroundColor(),
                MinPixelsForBaseDisc          = minPixelsForBaseDisc,
                MinPixelsForBaseDiscEndOfEdge = 10,
                ResizeHeight = null,
                ResizeWidth  = null,
                BackgroundStrippingParams = TestHelper.GetScreenBasedParamsForFirstMarioImage()
            };

            Bitmap image;

            if (inputParams.ResizeWidth.HasValue && inputParams.ResizeHeight.HasValue)
            {
                image = MainProcessor.ResizeJpg(filePath, null, inputParams.ResizeWidth.Value, inputParams.ResizeHeight.Value);
            }
            else
            {
                image = (Bitmap)Image.FromFile(filePath);
            }
            MainProcessor.StripBackground(image, inputParams.BackgroundStrippingParams);

            var calculator = new ClickPositionCalculator(image, inputParams);
            var topLeftEnd = calculator.GetDiscTopLeftEnd();

            Assert.IsNotNull(topLeftEnd);
            var topRightEnd = calculator.GetDiscTopRightEnd();

            Assert.IsNotNull(topRightEnd);

            var g = Graphics.FromImage(image);

            //g.FillEllipse(Brushes.Coral, topLeftEnd.Value.X - 8, topLeftEnd.Value.Y - 8, 16, 16);
            //g.FillEllipse(Brushes.Cyan, topRightEnd.Value.X - 8, topRightEnd.Value.Y - 8, 16, 16);
            g.DrawLine(Pens.White, topLeftEnd.Value.X, topLeftEnd.Value.Y, topRightEnd.Value.X, topRightEnd.Value.Y);

            g.Dispose();

            image.Save(ExecutionDirInfoHelper.GetOutputDirPath() + outputFileName);
        }
コード例 #23
0
        //END DELEGATES

        public frmNR2003Ratings()
        {
            InitializeComponent();

            //HIDE THE DEV TOOLSTRIP IN RELEASE MODE
#if !DEBUG
            this.devToolStripMenuItem.Visible = false;
#endif
            this.mainProc = new MainProcessor();

            this.carListWorker = new BackgroundWorker();
            this.carListWorker.WorkerReportsProgress = true;
            this.carListWorker.DoWork             += new DoWorkEventHandler(carListWorker_DoWork);
            this.carListWorker.ProgressChanged    += new ProgressChangedEventHandler(carListWorker_ProgressChanged);
            this.carListWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(carListWorker_RunWorkerCompleted);

            this.mainProc.RealDriverCollectionChanged += new EventHandler(mainProc_RealDriverCollectionChanged);
            this.mainProc.MessageRaised += new EventHandler <EventArgs <Message> >(mainProc_MessageRaised);

            this.LoadNR2003Instances();
        }
コード例 #24
0
        public void MainProcessor_Remove()
        {
            IMainProcessor processor = new MainProcessor();

            Assert.AreEqual(0, processor.QueueLength);

            processor.Add("1");
            Assert.AreEqual(1, processor.QueueLength);

            while (processor.QueueLength > 0)
            {
                Thread.Yield();
            }

            processor.Remove("1");
            while (processor.Processed == 0)
            {
                Thread.Yield();
            }

            Assert.AreEqual(0, processor.QueueLength);
            Assert.IsNull(processor.GetStatus("1"));
        }
コード例 #25
0
        private void Generate8CornerTexture()
        {
            if (_8CornerTextureAndBitmap != null)
            {
                return;
            }
            var indices = MainProcessor.GetIndicesFor8CornerTexture(_createMeshContract.ClickInputs.Angles);

            if (indices == null)
            {
                MessageBox.Show("Error in generating textures: Cannot identify photos for eight corners.\nPlease check if photos are available for a full 360 degree view.");
                return;
            }
            var quickProcessingWindow = new QuickProcessingWindowHelper(ParentGrid);
            var add8CornerTexture     = MainProcessor.GetAddTextureInfoForIndexCollection(_createMeshContract, indices);

            _8CornerTextureAndBitmap = TextureProcessor.GenerateTexture(add8CornerTexture, (MeshGeometry3D)_currentModel.Geometry, "");
            quickProcessingWindow.Close();
            if (indices.Length < 8)
            {
                MessageBox.Show(string.Format("Texture generated for {0} images as only {0} out of 8 images could be identified.", indices.Length));
            }
        }
コード例 #26
0
        public void TestWithExtraWidthThatMakesLeftNegative()
        {
            var imageFolder = string.Format(@"{0}\{1}", ExecutionDirInfoHelper.GetInputDirPath(), "testcropping_disc_very_left_of_image");

            var clickInputs = MainProcessor.GetClickInputsFromFile(imageFolder + @"\ClickInputs.xml");

            var imagePath = string.Format(@"{0}\{1}", imageFolder, clickInputs.ImageClickInputDetailsList[0].ImageName);

            _image = (Bitmap)Image.FromFile(imagePath);

            var imageAlterationParams = new ImageAlterationParams
            {
                MinImageHeightRatio  = 0.7,
                PercentExtraWidth    = 10,
                InvalidColor         = _bkColor,
                BottomPaddingPercent = 0
            };
            var croppedImg = ImageCropper.GetCroppedImage(clickInputs.ImageClickInputDetailsList[0], _image, imageAlterationParams);

            var outputPath = string.Format(@"{0}\cropped_with_extra_beyond_left.jpg", _outputFolder);

            croppedImg.Save(outputPath);
        }
コード例 #27
0
        public void TestMethod1()
        {
            string[] dir = new string[1];
            dir[0] = @"D:\Main\First";

            IFileWrapper fileWrapperDependency =
                Mock.Of <IFileWrapper>(d => d.GetDirectiry("") == dir);
            var currentDirectory = fileWrapperDependency.GetDirectiry("");

            var sut = new MainProcessor(new ProccessReversed1(),
                                        fileWrapperDependency).GetDirectories("");

            var result = sut.Result;

            List <string> list = new List <string>();

            foreach (var item in result)
            {
                list.Add(item);
            }

            Assert.IsTrue(list.Contains(@"D:\Main\First"));
        }
コード例 #28
0
        private static Point GetRotatedPositionDeprecated(float rotationAngleToRealign, Point currentPosition, int displayWidth, int displayHeight)
        {
            System.Drawing.Color bkColor = System.Drawing.Color.FromArgb(200, 200, 200);

            var bitmap = new Bitmap(displayWidth, displayHeight);
            var g      = Graphics.FromImage(bitmap);

            g.Clear(bkColor);
            g.Dispose();

            var positionColor = System.Drawing.Color.DarkViolet;

            bitmap.SetPixel((int)currentPosition.X, (int)currentPosition.Y, positionColor);
            bitmap.SetPixel((int)currentPosition.X + 1, (int)currentPosition.Y, positionColor);
            bitmap.SetPixel((int)currentPosition.X - 1, (int)currentPosition.Y, positionColor);
            bitmap.SetPixel((int)currentPosition.X, (int)currentPosition.Y + 1, positionColor);
            bitmap.SetPixel((int)currentPosition.X, (int)currentPosition.Y - 1, positionColor);
            bitmap.SetPixel((int)currentPosition.X + 1, (int)currentPosition.Y + 1, positionColor);
            bitmap.SetPixel((int)currentPosition.X - 1, (int)currentPosition.Y - 1, positionColor);


            var rotatedBitmap = MainProcessor.RotateImg(bitmap, rotationAngleToRealign, bkColor);

            for (var y = 0; y < displayHeight; y++)
            {
                for (var x = 0; x < displayWidth; x++)
                {
                    var color = rotatedBitmap.GetPixel(x, y);
                    if (color.R == positionColor.R && color.G == positionColor.G && color.B == positionColor.B)
                    {
                        return(new Point(x, y));
                    }
                }
            }

            throw new Exception("Could not find rotated position");
        }
コード例 #29
0
        private void Test(object sender, RoutedEventArgs e)
        {
            var @params    = GetParams();
            var testBitmap = (Bitmap)_bitmap.Clone();

            MainProcessor.StripBackground(testBitmap, @params);

            //Convert the image in resources to a Stream
            Stream memoryStream = new MemoryStream();

            testBitmap.Save(memoryStream, ImageFormat.Png);

            // Create a BitmapImage with the Stream.
            var bitmapImage = new BitmapImage();

            bitmapImage.BeginInit();
            bitmapImage.StreamSource = memoryStream;
            bitmapImage.EndInit();

            //set the display with this new image brush
            var imageBrush = new ImageBrush(bitmapImage);

            SampleImageCanvas.Background = imageBrush;
        }
コード例 #30
0
        protected override void OnStart(string[] args)
        {
            processor = new MainProcessor();

            processor.Start();
        }