public void CheckItAllCamera() { string[] basePathsToXlms = Directory.GetFileSystemEntries(StaticDataBase.pathToFolderWithXmls); StaticDataBase sDB = new StaticDataBase(); StaticDataBase.BestMatchProcent = 0; sDB.NameOfBestMatch = ""; for (int index = 0; index < basePathsToXlms.Length; index++) { ThreadPool.QueueUserWorkItem(CheckPicturesFromCamera, basePathsToXlms[index]); } }
void arraysOfPrabability(byte[] firstDoubleArray, byte[] secondDoubleArray, int reach, string myPath) { for (int indexOutside = -reach; indexOutside <= reach; indexOutside += StaticDataBase.howMuchReachForLoop) { if (arraysOfPrabability(firstDoubleArray, secondDoubleArray) > StaticDataBase.BestMatchProcent) { StaticDataBase sDB = new StaticDataBase(); StaticDataBase.BestMatchProcent = arraysOfPrabability(firstDoubleArray, secondDoubleArray); sDB.NameOfBestMatch = myPath[myPath.Length - 5].ToString(); } } }
private void useCamera() { if (!StaticDataBase.isCameraWorking) { StaticDataBase.isCameraWorking = true; CameraButton.Text = "Stop Camera"; } else { StaticDataBase.isCameraWorking = false; CameraButton.Text = "Start Camera"; } ImageViewer viewer = new ImageViewer(); Capture capture = new Capture(); double counter = 0; while (StaticDataBase.isCameraWorking) { CommonMethods Cm = new CommonMethods(); SignToLetterClass sC = new SignToLetterClass(); StaticDataBase sDB = new StaticDataBase(); loadedPictureBox.Image = capture.QueryFrame(); Image <Bgr, Byte> buffImage = capture.QueryFrame().ToImage <Bgr, Byte>(); buffImage.ROI = new System.Drawing.Rectangle(StaticDataBase.mouseStartX, StaticDataBase.mouseStartY, Math.Abs(StaticDataBase.mouseStopX - StaticDataBase.mouseStartX), Math.Abs(StaticDataBase.mouseStopY - StaticDataBase.mouseStartY)); resultImageBox.Image = (Cm.DropZeros(Cm.UseFilters(buffImage, StaticDataBase.resizeXInPixels, StaticDataBase.resizeYInPixels))); StaticDataBase.PictureFromCamera = buffImage; if ((double)counter % 10 == 0) { lock (StaticDataBase.PictureFromCamera) { sC.CheckItAllCamera(); } } if (StaticDataBase.galleryModeOn) { buffImage.Save(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\cameraImg\\" + counter.ToString() + ".jpg"); } Thread.Sleep(50); if ((double)counter % 10 == 0) { sDB.NameOfBestMatch = ""; StaticDataBase.BestMatchProcent = 0; } counter++; } }
private void OnDataChanged(object source, EventArgs args) { StaticDataBase sDB = new StaticDataBase(); labelForProcents.Text = StaticDataBase.BestMatchProcent.ToString(); labelForrResult.Text = sDB.NameOfBestMatch; numericUpDown1.Value = StaticDataBase.Blue_threshold; numericUpDown2.Value = StaticDataBase.Green_threshold; numericUpDown3.Value = StaticDataBase.Red_threshold; numericUpDown4.Value = StaticDataBase.maxBlueThreshold; numericUpDown5.Value = StaticDataBase.maxGreenThreshold; numericUpDown6.Value = StaticDataBase.maxRedThreshold; }