예제 #1
0
        private void UpdateScanVariables()
        {
            // cameraCapture.Init_camera(24 / DevSettingsProp.DistanceToMovePerImageY, Constants.CPU_WIDTH / DevSettingsProp.DistanceToMovePerImageX, UsrSettings.SavePath, DateTime.Now.ToString());
            var file_name = "c";

            cameraCapture.Init_camera(2, 2, UsrSettings.SavePath, file_name + CpuScanned.ToString());

            var temp_img_list = m_stitcher.Load_images_vm(UsrSettings.SavePath, 2, 2, "Topc" + CpuScanned.ToString());
            var temp_stitched = m_stitcher.Stitch_vm(temp_img_list);

            // m_decoded = m_barcode.Barcode_decoder(m_barcode.Find_barcode(temp_stitched));
            m_decoded = m_barcode.Barcode_finding_run(temp_stitched);

            //Create a folder for CPU: XML file + stitched image
            String cpu_folder_name = "ACIS" + "_" + m_decoded + "_" + DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss");
            String cpu_folder_path = Path.Combine(UsrSettings.SavePath, cpu_folder_name);
            String cpu_image_path  = Path.Combine(cpu_folder_path, cpu_folder_name + ".jpg");

            Directory.CreateDirectory(cpu_folder_path);
            CreateXMLFile(cpu_folder_path, m_decoded);
            temp_stitched.Save(cpu_image_path);

            //Add to UI list
            ScannedCPUCollection.Add(new ScannedCPUInfo(m_decoded, cpu_image_path, cpu_folder_path));
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                m_home.ScrollScannedCPUs.ScrollToBottom();
            }));

            ++CpuScanned;
            m_cpu_done = false;
            Progress   = ((float)CpuScanned / (float)DevSettingsProp.CpusToScan) * 100;
        }
예제 #2
0
        private async void Scan()
        {
            try
            {
                _isScanable = false;
                await Task.Run(
                    () =>
                {
                    LogInfo("Start Scanning");
                    CalibrateCameras();
                    var file_name = "c";
                    first_capture = true;
                    cameraCapture.Init_camera(2, 2, UsrSettings.SavePath, file_name + CpuScanned.ToString());

                    //Scan the first column
                    MoveToStartOfColumn(DevSettingsProp.DistanceFromHomeToTray, DevSettingsProp.DistanceFromHomeToTrayY);


                    //cameraCapture.Init_camera(24 / DevSettingsProp.DistanceToMovePerImageY, Constants.CPU_WIDTH / DevSettingsProp.DistanceToMovePerImageX, UsrSettings.SavePath, CpuScanned.ToString()); //UsrSettings.SavePath
                    while (m_y_axis_dividers_count < DevSettingsProp.YaxisCpuDividers)
                    {
                        do
                        {
                            ScanRow(DevSettingsProp.DistanceFromHomeToTrayMiddleBar);
                            MoveStartOfRow(DevSettingsProp.DistanceFromStartOfTrayToMiddleBar, DevSettingsProp.DistanceToMovePerImageY);
                        } while (!m_cpu_done);
                        UpdateScanVariables();
                    }

                    m_y_axis_dividers_count = 0;

                    //Scan the second column
                    MoveToStartOfColumn(DevSettingsProp.DistanceFromHomeToTrayMiddleBar, DevSettingsProp.DistanceFromHomeToTrayY);
                    cameraCapture.Init_camera(24 / DevSettingsProp.DistanceToMovePerImageY, Constants.CPU_WIDTH / DevSettingsProp.DistanceToMovePerImageX, UsrSettings.SavePath, DateTime.Now.ToString());
                    while (m_y_axis_dividers_count < DevSettingsProp.YaxisCpuDividers)
                    {
                        do
                        {
                            ScanRow(DevSettingsProp.DistanceFromHomeToEndOfTrayX);
                            MoveStartOfRow(DevSettingsProp.DistanceFromMiddleBarToEndTray, DevSettingsProp.DistanceToMovePerImageY);
                        } while (!m_cpu_done);
                        UpdateScanVariables();
                    }
                });

                OpenTrayAxis();
                LogInfo("Done Scanning");
                _isScanable = true;
            }
            catch
            {
                if (m_scan_cancel.IsCancellationRequested)
                {
                    CreateNewCancellationToken();
                }
                LogError("Scan canceled");
                return;
            }
        }