public Thumb(GlyphRecognitionStudio.MainForm newFrm,int img_indx) { InitializeComponent(); switch (img_indx) { case 1: { pictureBox1.ImageLocation = "E:\\Work\\Visual Matrix Analyser\\Visual Matrix Analyser\\Images\\play-pause.png"; break; } case 2: { pictureBox1.ImageLocation = "E:\\Work\\Visual Matrix Analyser\\Visual Matrix Analyser\\Images\\next.jpg"; break; } case 3: { pictureBox1.ImageLocation = "E:\\Work\\Visual Matrix Analyser\\Visual Matrix Analyser\\Images\\prev.jpg"; break; } case 4: { pictureBox1.ImageLocation = "E:\\Work\\Visual Matrix Analyser\\Visual Matrix Analyser\\Images\\vol.png"; break; } } }
void glyphRecogniser_frameProcessed(object sender, GlyphRecognitionStudio.MainForm.FrameData frameData) { baseImage = frameData.getImage(); this.Dispatcher.Invoke(new Action(() => image_baseImagePicker.Source = loadBitmap(baseImage))); if (waitingForNextBaseImage) { map = mapBuilder.BuildMap(baseImage, frameData.getGlyphs()); if (map != null) { this.Dispatcher.Invoke(new Action(() => TextBlock_marksInfo.Text = map.ToString())); this.Dispatcher.Invoke(new Action(() => DrawMap(map))); this.Dispatcher.Invoke(new Action(() => plannerBackGround.Source = loadBitmap(baseImage))); this.Dispatcher.Invoke(new Action(() => Canvas_trackPlanner.UpdateLayout())); } else { this.Dispatcher.Invoke(new Action(() => TextBlock_marksInfo.Text = "Map couldn't be build basing on current image!")); } //waitingForNextBaseImage = false; Console.WriteLine("New base frame acquired!"); } else { if (map != null) { mapBuilder.UpdateCarPosition(map, frameData.getGlyphs()); this.Dispatcher.Invoke(new Action(() => DrawMap(map))); Console.WriteLine("Car position updated!"); if (carUnderDriving) { CarSteering carSteering = carDriver.CalculateCarSteering(map); this.Dispatcher.Invoke(new Action(() => TextBlock_CarSteeringInformations.Text = carSteering.ToString())); carController.SetTargetSpeed(carSteering.speed); carController.SetTargetWheelAngle(carSteering.angle); carController.OverrideTargetBrakeSetting(carSteering.brake); } } } }