示例#1
0
        private void openImgButton_Click(object sender, RoutedEventArgs e)
        {
            string filename = OpenImgFile();

            if (filename != null)
            {
                try
                {
                    //此部分程式使用時要擺放在取得影像區塊
                    //-----------
                    Image <Bgr, byte> observedImg = new Image <Bgr, byte>(filename);

                    if (goodsRecogSys != null)
                    {
                        goodsRecogSys.SetupInputImage(observedImg);
                    }
                    else
                    {
                        goodsRecogSys = new GoodsRecognition(observedImg);
                    }

                    string goodData = goodsRecogSys.RunRecognition(true);
                    System.Windows.MessageBox.Show("商品資訊:" + goodData);
                    //-----------
                }
                catch (Exception ex)
                {
                    System.Windows.MessageBox.Show(ex.Message);
                }
            }
        }
示例#2
0
        private void capTimer_Tick(object sender, EventArgs e)
        {
            //如果有影片
            if (isRunCamera)
            {
                observedImg = capture.QueryFrame();
                if (observedImg != null)
                {
                    if (goodsRecogSys != null)
                    {
                        goodsRecogSys.SetupInputImage(observedImg);
                    }
                    else
                    {
                        goodsRecogSys = new GoodsRecognition(observedImg);
                    }

                    string goodData = goodsRecogSys.RunRecognition(true);
                    System.Windows.MessageBox.Show("商品資訊:" + goodData);
                }
            }
        }