Пример #1
0
		void UploadSamplesToStation()
		{
			try {
				FolderBrowserDialog selectPicturesFolderDialog=new FolderBrowserDialog();
				selectPicturesFolderDialog.ShowNewFolderButton = false;
				if (selectPicturesFolderDialog.ShowDialog()==DialogResult.OK)
				{
					foreach (string jpg in Directory.GetFiles( selectPicturesFolderDialog.SelectedPath,"*.jpg"))
					{
						Sample nextSample = new Sample(_currentStation.Lat, _currentStation.Lon, jpg);
						
						//OCR template for presure in inHg
						OCR_Template ocrPres=new OCR_Template("ocrPres","Moultrie Game Camera",
						                                      new Rectangle(71,2018,225,96),new Size(2848,2136));
						//OCR template for temp in ºC
						OCR_Template ocrTemp=new OCR_Template("ocrTemp","Moultrie Game Camera",
						                                      new Rectangle(847,2024,196,111),new Size(2848,2136));
						nextSample.OCR_Observations_list.Add(new DoubleObservation("Pressure (inHg)","",ocrPres));
						nextSample.OCR_Observations_list.Add(new IntegerObservation("Temperature (ºC)","",ocrTemp));
						nextSample.Species_Observations_list.Add(new SpeciesObservation("Species","Pending",0));
						
						nextSample.RunOCR(nextSample.OCR_Observations_list);
						
						Image nextImage = Image.FromFile(jpg);
						
						foreach(Station st in _currentProject.StationsList)
						{
							if(st.Guid==_currentStation.Guid)
							{
								st.SamplesList.Add(nextSample);
							}
						}
						
						ProjectDAO.InsertImage(_currentProject.Name, nextSample.Guid, ConversionUtilities.ImageToBase64(Main_processing.ResizeImage(nextImage), System.Drawing.Imaging.ImageFormat.Jpeg));
						
					}
					
					ProjectDAO.UpdateProject(_currentProject.Name,_currentProject);
					
				}
			} catch (Exception ex) {
				throw ex;
			}
			
			
		}
		public StringObservation(string Name, string Value, OCR_Template OCR):base(Name,Value)
		{
			
			_OCR=OCR;
		}
Пример #3
0
		void BtCreateSamplesClick(object sender, EventArgs e)
		{
			
			if (_folderSelected==DialogResult.OK)
			{
				foreach (string jpg in Directory.GetFiles( Path.GetFullPath(txtPicturesFolder.Text),"*.jpg"))
		    	{
					Sample nextSample = new Sample(_updatedStation.Lat, _updatedStation.Lon, jpg);
					
					//OCR template for presure in inHg
					OCR_Template ocrPres=new OCR_Template("ocrPres","Moultrie Game Camera",
					                                      new Rectangle(71,2018,225,96),new Size(2848,2136));
					//OCR template for temp in ºC
					OCR_Template ocrTemp=new OCR_Template("ocrTemp","Moultrie Game Camera",
					                                      new Rectangle(847,2024,196,111),new Size(2848,2136));
					nextSample.OCR_Observations_list.Add(new DoubleObservation("Pressure (inHg)","",ocrPres));
					nextSample.OCR_Observations_list.Add(new IntegerObservation("Temperature (ºC)","",ocrTemp));
					nextSample.Species_Observations_list.Add(new SpeciesObservation("Species","Pending",0));
					
					nextSample.RunOCR(nextSample.OCR_Observations_list);
					
					Image nextImage = Image.FromFile(jpg);
					
					foreach(Station st in _updatedProject.StationsList)
					{
						if(st.Guid==_updatedStation.Guid)
						{
							st.SamplesList.Add(nextSample);
						}
					}
					
					ProjectDAO.InsertImage(_updatedProject.Name, nextSample.Guid, ConversionUtilities.ImageToBase64(nextImage, System.Drawing.Imaging.ImageFormat.Jpeg));
					
				}
				
					ProjectDAO.UpdateProject(_updatedProject.Name,_updatedProject);

			}
			
			
			
			
		}