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(); }
public ViewModel(Home home) { m_home = home; m_waitHandle = new AutoResetEvent(false); cpu_done = false; m_scan_cancel = new CancellationTokenSource(); m_arduinoControl = new ArduinoControl(m_waitHandle, m_scan_cancel); m_motors = new Motor[Constants.NUMBER_OF_MOTORS]; for (int i = 0; i < Constants.NUMBER_OF_MOTORS; ++i) { m_motors[i] = new Motor(); } cameraCapture = new CameraCapture(); /**********Added for barcode*********/ m_barcode = new Barcode(); /*********Added for ImageStitching*********/ m_stitcher = new ImageStitching(); m_collabrated = false; m_cpu_scanned = 0; m_y_axis_dividers_count = 0; m_progress = 0; m_cpu_done = false; UpdateLoggerPath(); UsrSettings.PropertyChanged += UpdateLoggerPathEventHandler; DevSettingsProp.SettingChanging += ValidateDevSettings; BindingOperations.EnableCollectionSynchronization(ErrorMessages, m_lock); //This is needed to update the collection BindingOperations.EnableCollectionSynchronization(InfoMessages, m_lock); }
/* Clean up objects: */ static void Cleanup(AppDomain domain, ImageStitching stitcher) { AppDomain.Unload(domain); stitcher.Cleanup(); }