public TrafficSignRecognitionForm() { InitializeComponent(); _stopSignDetector = new StopSignDetector(); ProcessImage(new Image <Bgr, byte>("stop-sign.jpg")); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); OnImagePicked += (sender, image) => { using (Mat stopSignModel = new Mat(Assets, "stop-sign-model.png")) { if (image == null) return; Stopwatch watch = Stopwatch.StartNew(); // time the detection process List<Mat> stopSignList = new List<Mat>(); List<Rectangle> stopSignBoxList = new List<Rectangle>(); StopSignDetector detector = new StopSignDetector(stopSignModel); detector.DetectStopSign(image, stopSignList, stopSignBoxList); watch.Stop(); //stop the timer SetMessage(String.Format("Detection time: {0} milli-seconds", watch.Elapsed.TotalMilliseconds)); foreach (Rectangle rect in stopSignBoxList) CvInvoke.Rectangle(image, rect, new Bgr(System.Drawing.Color.Red).MCvScalar, 2); SetImageBitmap(image.ToBitmap()); image.Dispose(); } }; OnButtonClick += (sender, args) => { PickImage("stop-sign.jpg"); }; }
public TrafficSignRecognitionForm() { InitializeComponent(); _stopSignDetector = new StopSignDetector(); ProcessImage(new Image<Bgr, byte>("stop-sign.jpg")); }
public override void ViewDidLoad() { base.ViewDidLoad(); ButtonText = "Detect Stop Sign"; OnButtonClick += delegate { using (Mat stopSignModel = new Mat("stop-sign-model.png")) using (Mat image = new Mat("stop-sign.jpg")) { Stopwatch watch = Stopwatch.StartNew(); // time the detection process List<Mat> stopSignList = new List<Mat>(); List<Rectangle> stopSignBoxList = new List<Rectangle>(); StopSignDetector detector = new StopSignDetector(stopSignModel); detector.DetectStopSign(image, stopSignList, stopSignBoxList); watch.Stop(); //stop the timer foreach (Rectangle rect in stopSignBoxList) { CvInvoke.Rectangle(image, rect, new MCvScalar(0, 0, 255), 2); } Size frameSize = FrameSize; using (Mat resized = new Mat()) { CvInvoke.ResizeForFrame(image, resized, frameSize); MessageText = String.Format("Detection time: {0} milli-seconds", watch.Elapsed.TotalMilliseconds); SetImage(resized); } } }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); OnButtonClick += delegate { using (Image<Bgr, byte> stopSignModel = new Image<Bgr, byte>(Assets, "stop-sign-model.png")) using (Image<Bgr, Byte> image = PickImage("stop-sign.jpg")) { if (image == null) return; Stopwatch watch = Stopwatch.StartNew(); // time the detection process List<Mat> stopSignList = new List<Mat>(); List<Rectangle> stopSignBoxList = new List<Rectangle>(); StopSignDetector detector = new StopSignDetector(stopSignModel); detector.DetectStopSign(image.Mat, stopSignList, stopSignBoxList); watch.Stop(); //stop the timer SetMessage(String.Format("Detection time: {0} milli-seconds", watch.Elapsed.TotalMilliseconds)); foreach (Rectangle rect in stopSignBoxList) image.Draw(rect, new Bgr(System.Drawing.Color.Red), 2); SetImageBitmap(image.ToBitmap()); } }; }
public override void ViewDidLoad() { base.ViewDidLoad(); ButtonText = "Detect Stop Sign"; OnButtonClick += delegate { using (Image<Bgr, byte> stopSignModel = new Image<Bgr, byte>("stop-sign-model.png")) using (Image<Bgr, Byte> image = new Image<Bgr, Byte>("stop-sign.jpg")) { Stopwatch watch = Stopwatch.StartNew(); // time the detection process List<Image<Gray, Byte>> stopSignList = new List<Image<Gray, byte>>(); List<Rectangle> stopSignBoxList = new List<Rectangle>(); StopSignDetector detector = new StopSignDetector(stopSignModel); detector.DetectStopSign(image, stopSignList, stopSignBoxList); watch.Stop(); //stop the timer foreach (Rectangle rect in stopSignBoxList) { image.Draw(rect, new Bgr(Color.Red), 2); } Size frameSize = FrameSize; using (Image<Bgr, byte> resized = image.Resize(frameSize.Width, frameSize.Height, Emgu.CV.CvEnum.Inter.Cubic, true)) { MessageText = String.Format("Detection time: {0} milli-seconds", watch.Elapsed.TotalMilliseconds); SetImage(resized); } } }; }
public TrafficSignRecognitionForm() { InitializeComponent(); _stopSignDetector = new StopSignDetector(); timer = new System.Windows.Forms.Timer(); timer.Tick += new EventHandler(timer_Tick); checks_after_detection = new double[10]; last_rectangle = new Rectangle[10]; String txt; txt = "stop-sign.jpg"; img0 = new Image <Bgr, byte>(txt); /* * Image<Bgr, Byte> noise; * noise = img0.CopyBlank(); * * MCvScalar a, b; * a = new MCvScalar(90.0,90.0,50.0); * b = new MCvScalar(10.0,10.0,10.0); * noise.SetRandNormal(a, b); * img0 = img0 - noise; * */ ProcessImage(); cam = new CameraCapture(); }
public TrafficSignRecognitionForm() { InitializeComponent(); using (Image <Bgr, Byte> stopSignModel = new Image <Bgr, Byte>("stop-sign-model.png")) using (Image <Bgr, Byte> image = new Image <Bgr, byte>("stop-sign.jpg")) { _stopSignDetector = new StopSignDetector(stopSignModel); ProcessImage(image); } }
public TrafficSignRecognitionForm() { InitializeComponent(); using (Image <Bgr, Byte> stopSignModel = new Image <Bgr, Byte>("stop-sign-model.png")) { Mat image = CvInvoke.Imread("stop-sign.jpg", LoadImageType.Color); _stopSignDetector = new StopSignDetector(stopSignModel); ProcessImage(image); } }
public TrafficSignRecognitionForm() { InitializeComponent(); using (Image<Bgr, Byte> stopSignModel = new Image<Bgr, Byte>("stop-sign-model.png")) { Mat image = CvInvoke.Imread("stop-sign.jpg", LoadImageType.Color); _stopSignDetector = new StopSignDetector(stopSignModel); ProcessImage(image); } }