static void Main(string[] args) { AppDomain domain = Startup(); ImageStitching stitcher = new ImageStitching(); Barcode decoder = new Barcode(); ObjectDetection detector = new ObjectDetection(); string cpu_folder_name; /* Stitch Image and decode barcode: */ var img_list = stitcher.Load_images(SolutionDir.ToString(), Data.Constants.Seg_R, Data.Constants.Seg_R, Data.Constants.filename_top); var img = stitcher.Stitch(img_list); var barcode = decoder.Barcode_finding_run(img); /* Create file and save Image: */ cpu_folder_name = "ACIS_" + DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss"); string save_path = SolutionDir.ToString() + "\\" + cpu_folder_name; Directory.CreateDirectory(Path.Combine(SolutionDir.ToString(), cpu_folder_name)); String fileName = "BarcodeInfo_" + Data.Constants.filename_top + ".xml"; new XDocument(new XElement("ACIS", new XElement("barcode", barcode))).Save(Path.Combine(save_path, fileName)); img.Save(Path.Combine(save_path, Data.Constants.filename_top + ".jpg")); /* Defect Detection: */ Cleanup(domain, stitcher); Console.WriteLine("\n\n"); Console.WriteLine("The stitched image and xml file holding the barcode has been saved"); Console.WriteLine("The save location is in the ACIS_Showcase solution directory under Images"); Console.WriteLine("Defect Detection Will be added shortly."); Console.WriteLine("Thank you. Hit Enter to continue:"); Console.ReadLine(); }
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; }