public void timer_tick(object source, EventArgs e) { if (mov2 == true) { if (mov == false) //verificación de cuando el movieento haya cesado { cont++; if (cont == 10) { cont = 0; //catchPlate((Bitmap)pictureBox1.Image); //MessageBox.Show("No Movimiento"); webServiceInteraction wServInt = new webServiceInteraction(); parkingC.LastParkingStatus = wServInt.getParkingStatus();// obtener estado anterior del parqueadero Hashtable pCurrentList = OccupancyChecker(); Hashtable changedLots = parkingSlot.compareCurrentAndPrevious(pCurrentList, parkingC.LastParkingStatus); //cuales aparcamientos cambiaron y su nuevo estado foreach (String key in changedLots.Keys) { wServInt.updateSlotStatus(key, changedLots[key].ToString()); if (changedLots[key].Equals("Ocupado")) { carPlate = new carPlate(); carPlate.PUsingLot = key; LincensePlate(key); } } // mov2 = false; } } else { cont = 0; } } }
private void catchPlateImg(Bitmap original) { framesProcessing fprocessing = new framesProcessing(); Bitmap rgb = (Bitmap)original.Clone(); Bitmap hsv = fprocessing.rgb2hsv((Bitmap)original.Clone()); //Binarization: fprocessing.binarization(ref rgb, ref hsv); //Common bits bwn rgb and hsv Bitmap commImg = fprocessing.commonBits(rgb, hsv); //Image dilatation Bitmap dilatedImg = fprocessing.diamonDilatation(commImg); //get the plate n times ????? try { carPlate.PlateImg = fprocessing.getBiggestBloob(commImg, original); carPlate.PlateImg.Save(@"placa.jpg"); //carPlate.PlateImg = fprocessing.getBiggestBloob(commImg, original); pictureBox7.Image = carPlate.PlateImg; //pictureBox7.SizeMode = PictureBoxSizeMode.StretchImage; //do image plate filter process carPlate.invertImgPixels(); carPlate.setGrayScaleImg(); carPlate.binarizeImg(); carPlate.filterBlobs(); //do tesseract process carPlate.obtainPlateLetters(); webServiceInteraction wsint = new webServiceInteraction(); wsint.persistDBLog(carPlate.PlateStr, carPlate.PUsingLot); //MessageBox.Show(carPlate.PlateStr); textBox1.Text = (carPlate.PlateStr); } catch (Exception) { } }