public Tracker() { InitializeComponent(); InitialCaiServer(); MessageBox.Show("TCP IP is " + server.getUsedIP().ToString() + " port is " + server.getPort().ToString()); udp = new CaiNetwork.CaiUDP(); MessageBox.Show("UDP IP is " + udp.broadcastIpEndPoint.Address.ToString() + " port is " + udp.broadcastIpEndPoint.Port.ToString()); tbsPoint = new TextBox[] { tbPoint1, tbPoint2, tbPoint3, tbPoint4 }; // Init flags = new MyFlags(); flags.Init(); flags.Start(); ptsShowCorners = new Point2f[4]; cc = new CoordinateConverter(flags); localiser = new Localiser(); capture = new VideoCapture(); // threadCamera = new Thread(CameraReading); /****************************************** 修改了此处,调用电脑自带摄像头 ******************************************/ capture.Open(0); //capture.Open(1); timeCamNow = DateTime.Now; timeCamPrev = timeCamNow; car1 = new Point2i(); car2 = new Point2i(); buttonStart.Enabled = true; buttonPause.Enabled = false; button_reset.Enabled = false; Game.LoadMap(); game = new Game(); if (capture.IsOpened()) { capture.FrameWidth = flags.cameraSize.Width; capture.FrameHeight = flags.cameraSize.Height; capture.ConvertRgb = true; timer100ms.Interval = 75; timer100ms.Start(); //Cv2.NamedWindow("binary"); } portCB.Items.AddRange(System.IO.Ports.SerialPort.GetPortNames()); myID = 'A'; }