Exemplo n.º 1
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (mf != null) {
                mf.stopFlow();
                mf = null;
            }

            ADESPanel p1 = new ADESPanel(panel1);
            ADESPanel p2 = new ADESPanel(panel2);
            ADESPanel p3 = new ADESPanel(panel3);
            ADESPanel p4 = new ADESPanel(panel4);
            ADESPanel p5 = new ADESPanel(panel5);

            mf = new MessageFlow();

            /*
            mf.addConsumer(new PanelDisplayProcessor(p1, new UDPMsgService(new UDPAddress[] { new UDPAddress(serviceIP, ServicePort.PANEL_DISPLAY_SP_1) }, null)));
            mf.addConsumer(new CircularSignDetectorProcessor(new UDPMsgService(new UDPAddress[] { new UDPAddress(serviceIP, ServicePort.SIGN_DETECTION_SP) }, new UDPAddress[] { new UDPAddress(serviceIP, ServicePort.PANEL_DISPLAY_SP_1)})));
            mf.addInitiator(new FileVisionSource("C:\\Documents and Settings\\Administrator\\Desktop\\d.avi", new UDPMsgService(null, new UDPAddress[] { new UDPAddress(serviceIP, ServicePort.SIGN_DETECTION_SP)})));
            */

            PanelDisplayProcessor pdp = new PanelDisplayProcessor(p1, new BasicMsgService(null));
            PanelDisplayProcessor pdp2 = new PanelDisplayProcessor(p2, new BasicMsgService(null));
            PanelDisplayProcessor pdp3 = new PanelDisplayProcessor(p3, new BasicMsgService(null));
            PanelDisplayProcessor pdp4 = new PanelDisplayProcessor(p4, new BasicMsgService(null));
            PanelDisplayProcessor pdp5 = new PanelDisplayProcessor(p5, new BasicMsgService(null));

            MsgConsumer cnn = null;
            MsgConsumer tnn = null;
            if ("NN".Equals(Constants.NN_SVM_SURF)) {
                cnn = new NN_Processor(new BasicMsgService(pdp4), Constants.SignType.circular);
                tnn = new NN_Processor(new BasicMsgService(pdp5), Constants.SignType.triangular);
            }
            else if ("NN_SURF".Equals(Constants.NN_SVM_SURF) || "NN_12SIMPLE".Equals(Constants.NN_SVM_SURF))
            {
                cnn = new NN_SURFProcessor(new BasicMsgService(pdp4), Constants.SignType.circular);
                tnn = new NN_SURFProcessor(new BasicMsgService(pdp5), Constants.SignType.triangular);
            }
            else if ("SVM_SURF".Equals(Constants.NN_SVM_SURF) || "SVM_12SIMPLE".Equals(Constants.NN_SVM_SURF))
            {
                cnn = new SVM_SURFProcessor(new BasicMsgService(pdp4), Constants.SignType.circular);
                tnn = new SVM_SURFProcessor(new BasicMsgService(pdp5), Constants.SignType.triangular);
            }
            else if ("SVM".Equals(Constants.NN_SVM_SURF) || "SVM_12SIMPLE".Equals(Constants.NN_SVM_SURF))
            {
                MessageBox.Show("SVM Processor not implemented !");
            }

            CircularSignDetectorProcessor csdp = new CircularSignDetectorProcessor(new BasicMsgService(cnn), p2);
            TriangularSignDetectorProcessor tsdp = new TriangularSignDetectorProcessor(new BasicMsgService(tnn), p3);

            // CircularSignDetectorProcessor csdp = new CircularSignDetectorProcessor(null, p2);
            // TriangularSignDetectorProcessor tsdp = new TriangularSignDetectorProcessor(null, p3);

            LaneDetectorProcessor ldp = new LaneDetectorProcessor(new BasicMsgService(pdp));

            //HistogramProcessor hp = new HistogramProcessor(new BasicMsgService(pdp2));
            //AForgeProcessor afp = new AForgeProcessor(new HSLFiltering(new IntRange(-30, +30), new DoubleRange(0.0, 1.0), new DoubleRange(0.0, 1.0)), new BasicMsgService(pdp2));
            //AutoBrightnessProcessor abp = new AutoBrightnessProcessor(0.5, new Rectangle(256,0,255,287), new BasicMsgService(pdp2));
            //HoughLineProcessor htp = new HoughLineProcessor(new BasicMsgService(pdp));
            //PanelDisplayProcessor pdp = new PanelDisplayProcessor(p1, new BasicMsgService(null));
            //AForgeProcessor afp = new AForgeProcessor(new SpatialColorLabelFilter(new Color[] { Color.White, Color.Red, Color.Blue, Color.Black }), new BasicMsgService(pdp));
            // FileVisionSource fvs = new FileVisionSource("D:\\Kml\\PhD\\misc\\signs.avi", new DispatchMsgService(new MsgConsumer[] {pdp, sdp}));
            //FileVisionSource fvs = new FileVisionSource(@"C:\java\eclipse\workspace\PhD_utils\resimler\avi\all_sign.avi", new DispatchMsgService(new MsgConsumer[] { laneDetectionToolStripMenuItem.Checked ? (MsgConsumer)ldp : (MsgConsumer)pdp, csdp, tsdp }));
            FileVisionSource fvs = new FileVisionSource(@"C:\java\eclipse\workspace\PhD_utils\resimler\avi\all_sign.avi", new DispatchMsgService(new MsgConsumer[] { ldp }));
            // FileVisionSource fvs = new FileVisionSource("D:\\Kml\\PhD\\PhD Thesis\\media\\all_sign.avi", new DispatchMsgService(new MsgConsumer[] { pdp, csdp, tsdp }));
            // DeviceVisionSource dvs = new DeviceVisionSource(new DispatchMsgService(new MsgConsumer[] { pdp, sdp }));

            mf.addInitiator(fvs);

            mf.startFlow();
            Globals.TIME_START_MILLISEC = DateTime.Now.Ticks / 10000;
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            toolStripStatusLabel1.Text = "";
            panel1.CreateGraphics().Clear(Color.Transparent);
            if (mf != null)
            {
                mf.stopFlow();
                mf = null;
            }
            TextMsgHandler csdtmh = new TextMsgHandler(SignDetectionTextMessageHandler);
            ADESPanel p1 = new ADESPanel(panel1);
            TextMsgDisplayProcessor tmdp = new TextMsgDisplayProcessor(new BasicMsgService(null), csdtmh);
            PanelDisplayProcessor pdp = new PanelDisplayProcessor(p1, new BasicMsgService(null));
            MsgConsumer cnn = new NN_Processor(new DispatchMsgService(new MsgConsumer[] { pdp, tmdp }), Constants.SignType.circular);
            //MsgConsumer tnn = new NN_Processor(new DispatchMsgService(new MsgConsumer[] { pdp, tmdp }), Constants.SignType.triangular);
            MsgConsumer csdp = new CircularSignDetectorProcessor(new BasicMsgService(cnn), null);
            //MsgConsumer tsdp = new TriangularSignDetectorProcessor(new BasicMsgService(tnn), null);
            BitmapMemoryVisionSource bmps = new BitmapMemoryVisionSource(new DispatchMsgService(new MsgConsumer[] { csdp/*, tsdp*/ }));

            mf = new MessageFlow();
            mf.addInitiator(bmps);
            mf.startFlow();

            Bitmap bmp = new Bitmap(imgName);
            bmps.sendBmp(bmp);
        }
Exemplo n.º 3
0
        private void AdesDlg_Load(object sender, EventArgs e)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            cmbES.SelectedIndex = 0;
            serverHost.Text = getLocalIP();
            imgServerHost.Text = getLocalIP();
            unreal = new Unreal(appPath.Text);

            // Init ADES messageFlow for vision
            ADESPanel p1 = new ADESPanel(panel1);
            TextMsgHandler csdtmh = new TextMsgHandler(circularSignDetectionTextMessageHandler);

            mf = new MessageFlow();
            TextMsgDisplayProcessor tmdp = new TextMsgDisplayProcessor(new BasicMsgService(null), csdtmh);
            PanelDisplayProcessor pdp = new PanelDisplayProcessor(p1, new BasicMsgService(null));
            MsgConsumer cnn = new NN_Processor(new DispatchMsgService(new MsgConsumer[]{pdp, tmdp}), Constants.SignType.circular);
            CircularSignDetectorProcessor csdp = new CircularSignDetectorProcessor(new BasicMsgService(cnn), null);
            bmvs = new BitmapMemoryVisionSource(new BasicMsgService(csdp));
            mf.addInitiator(bmvs);
            mf.startFlow();
        }