Beispiel #1
0
 public void DetectMarkersInImage()
 {
     if (_markersDetected)
     {
         DetectMarkersButton.GetComponentInChildren <Text>().text = "Detect Markers";
         ResetTableCalibration();
     }
     else
     {
         // use camera control singleton to detect markers
         bool success = camControl.DetectMarkersInCameraImage();
         // enable calibrateTableButton
         if (success)
         {
             _markersDetected   = true;
             StatusBarText.text = "Success";
             CalibrateTableButton.GetComponent <Button>().interactable = true;
             DetectMarkersButton.GetComponentInChildren <Text>().text  = "Reset Detection";
             // show detected markers in raw image view
             Texture2D frame = camControl.GetNextFrameAsImage(true);
             ImagePlane.texture = frame;
             (ImagePlane.texture as Texture2D).Apply();
         }
         else
         {
             // print status text about error
             StatusBarText.text = "Cannot detect markers in Image.";
         }
     }
 }
Beispiel #2
0
 // Update is called once per frame
 void Update()
 {
     camControl = CameraControl.CameraControl.cameraControl;
     if (camControl != null)
     {
         if (camControl.IsCameraChosen())
         {
             DetectMarkersButton.GetComponent <Button>().interactable = true;
             if (_showchessboard)
             {
                 //ImagePlane.texture = ChessboardTexture;
                 //(ImagePlane.texture as Texture2D).Apply();
             }
             else if (!_markersDetected || _tableCalibrated)
             {
                 Texture2D frame = camControl.GetNextFrameAsImage();
                 ImagePlane.texture = frame;
                 (ImagePlane.texture as Texture2D).Apply();
             }
         }
     }
 }