Exemple #1
0
    private void CameraController_onCameraStart(object sender, WebCamControllerEventArgs e)
    {
        Log.Info(
            "Camere Started",
            "Camera(" + e.webCamIndex + "): " + e.webCamName,
            "Size: " + e.webCamWidth + " x " + e.webCamHeight,
            "FPS: " + WebCamController.instance.activeWebCamTexture.requestedFPS,
            "videoRotationAngle: " + WebCamController.instance.activeWebCamTexture.videoRotationAngle,
            "videoVerticallyMirrored: " + WebCamController.instance.activeWebCamTexture.videoVerticallyMirrored);

        image.texture = WebCamController.instance.image;

        rotationVector.z = -WebCamController.instance.activeWebCamTexture.videoRotationAngle;
        image.rectTransform.localEulerAngles = rotationVector;

        //Set AspectRatioFitter's ratio
        float videoRatio =
            (float)WebCamController.instance.activeWebCamTexture.width / (float)WebCamController.instance.activeWebCamTexture.height;

        imageFitter.aspectRatio = videoRatio;

        // Unflip if vertically flipped
        image.uvRect =
            WebCamController.instance.activeWebCamTexture.videoVerticallyMirrored ? fixedRect : defaultRect;

        // Mirror front-facing camera's image horizontally to look more natural
        imageParent.localScale =
            WebCamController.instance.activeWebCamDevice.isFrontFacing ? fixedScale : defaultScale;
    }
Exemple #2
0
 private void CameraController_OnCameraErrorIndex(object sender, WebCamControllerEventArgs e)
 {
     Log.Error("Error on camera index: " + e.webCamIndex);
 }
Exemple #3
0
 private void CameraController_OnCameraStopped(object sender, WebCamControllerEventArgs e)
 {
     Log.Info("Camera Stopped (" + e.webCamIndex + ")");
 }
Exemple #4
0
 private void CameraController_OnCameraErrorDevice(object sender, WebCamControllerEventArgs e)
 {
     Log.Error("Error Playing Camera (" + e.webCamIndex + "): " + e.webCamName);
 }