Example #1
0
    void OnVideoCaptureCreated(HoloLensCameraStream.VideoCapture videoCapture)
    {
        if (videoCapture == null)
        {
            Debug.LogError("Did not find a video capture object. You may not be using the HoloLens.");
            return;
        }

        this._videoCapture = videoCapture;

        //Request the spatial coordinate ptr if you want fetch the camera and set it if you need to
        CameraStreamHelper.Instance.SetNativeISpatialCoordinateSystemPtr(_spatialCoordinateSystemPtr);

        _resolution = CameraStreamHelper.Instance.GetLowestResolution();
        float frameRate = CameraStreamHelper.Instance.GetHighestFrameRate(_resolution);

        videoCapture.FrameSampleAcquired += OnFrameSampleAcquired;

        //You don't need to set all of these params.
        //I'm just adding them to show you that they exist.
        HoloLensCameraStream.CameraParameters cameraParams = new HoloLensCameraStream.CameraParameters();
        cameraParams.cameraResolutionHeight = _resolution.height;
        cameraParams.cameraResolutionWidth  = _resolution.width;
        cameraParams.frameRate             = Mathf.RoundToInt(frameRate);
        cameraParams.pixelFormat           = HoloLensCameraStream.CapturePixelFormat.BGRA32;
        cameraParams.rotateImage180Degrees = true; //If your image is upside down, remove this line.
        cameraParams.enableHolograms       = false;

        UnityEngine.WSA.Application.InvokeOnAppThread(() => {
            _videoPanelUI.SetResolution(_resolution.width, _resolution.height);
        }, false);

        videoCapture.StartVideoModeAsync(cameraParams, OnVideoModeStarted);
    }
Example #2
0
    void OnVideoCaptureCreated(VideoCapture videoCapture)
    {
        if (videoCapture == null)
        {
            Debug.LogError("Did not find a video capture object. You may not be using the HoloLens.");
            return;
        }

        this._videoCapture = videoCapture;

        _resolution = CameraStreamHelper.Instance.GetLowestResolution();
        float frameRate = CameraStreamHelper.Instance.GetHighestFrameRate(_resolution);

        videoCapture.FrameSampleAcquired += OnFrameSampleAcquired;

        CameraParameters cameraParams = new CameraParameters();

        cameraParams.cameraResolutionHeight = _resolution.height;
        cameraParams.cameraResolutionWidth  = _resolution.width;
        cameraParams.frameRate   = Mathf.RoundToInt(frameRate);
        cameraParams.pixelFormat = CapturePixelFormat.BGRA32;

        UnityEngine.WSA.Application.InvokeOnAppThread(() => { _videoPanelUI.SetResolution(_resolution.width, _resolution.height); }, false);

        videoCapture.StartVideoModeAsync(cameraParams, OnVideoModeStarted);
    }
    void OnVideoCaptureCreated(VideoCapture videoCapture)
    {
        if (videoCapture == null)
        {
            Debug.LogError("Did not find a video capture object. You may not be using the HoloLens.");
            return;
        }

        this._videoCapture = videoCapture;

        //Request the spatial coordinate ptr if you want fetch the camera and set it if you need to
        CameraStreamHelper.Instance.SetNativeISpatialCoordinateSystemPtr(_spatialCoordinateSystemPtr);

        _resolution = CameraStreamHelper.Instance.GetLowestResolution();

        processedImageData = new byte[_resolution.height * _resolution.width * 4];

        initChessPoseController();
        setImageSize(_resolution.height, _resolution.width);

        float frameRate = CameraStreamHelper.Instance.GetHighestFrameRate(_resolution);

        //videoCapture.FrameSampleAcquired += OnFrameSampleAcquired;

        //You don't need to set all of these params.
        //I'm just adding them to show you that they exist.
        _cameraParams = new CameraParameters();
        _cameraParams.cameraResolutionHeight = _resolution.height;
        _cameraParams.cameraResolutionWidth  = _resolution.width;
        _cameraParams.frameRate             = Mathf.RoundToInt(frameRate);
        _cameraParams.pixelFormat           = CapturePixelFormat.BGRA32;
        _cameraParams.rotateImage180Degrees = true; //If your image is upside down, remove this line.
        _cameraParams.enableHolograms       = false;

        _cameraParams.AutoExposureEnabled = true;
        //_cameraParams.AutoExposureEnabled = false;
        //_cameraParams.ManualExposureAmount = 0.1f;

        UnityEngine.WSA.Application.InvokeOnAppThread(() => { _videoPanelUI.SetResolution(_resolution.width, _resolution.height); }, false);

        Debug.Log("Set up video capture. Ready to record.");



        Debug.Log("DUMMY INIT: mocking input coming in from top-down cam");
        // DUMMY:
        // act as if we have received the mock message...
        incomingMessageQueue.Enqueue(TEST_RECEIVED_MSG_FROM_TOPDOWN);   // COMMENT THIS LINE OUT if you are not wanting to use mock incoming top-down camera app data
    }
    void OnVideoCaptureCreated(VideoCapture videoCapture)
    {
        if (videoCapture == null)
        {
            Debug.LogError("Did not find a video capture object. You may not be using the HoloLens.");
            return;
        }

        this._videoCapture = videoCapture;

        _resolution = CameraStreamHelper.Instance.GetLowestResolution();
        //float frameRate = CameraStreamHelper.Instance.GetHighestFrameRate(_resolution);
        float frameRate = CameraStreamHelper.Instance.GetLowestFrameRate(_resolution);

        videoCapture.FrameSampleAcquired += OnFrameSampleAcquired;

        //You don't need to set all of these params.
        //I'm just adding them to show you that they exist.
        CameraParameters cameraParams = new CameraParameters();

        cameraParams.cameraResolutionHeight = _resolution.height;
        cameraParams.cameraResolutionWidth  = _resolution.width;

        //new
        frameRate = _videoPanelUI.requestedFrameRate;
        cameraParams.frameRate = Mathf.RoundToInt(frameRate);
        int finalFrameRate = Mathf.RoundToInt(frameRate);

        cameraParams.pixelFormat           = CapturePixelFormat.BGRA32;
        cameraParams.rotateImage180Degrees = true;         //If your image is upside down, remove this line.
        cameraParams.enableHolograms       = false;

        _videoPanelUI.SetResolution(_resolution.width, _resolution.height, finalFrameRate);

        videoCapture.StartVideoModeAsync(cameraParams, OnVideoModeStarted);
    }
Example #5
0
 // Use this for initialization
 void Start()
 {
     Initialize();
     videoPanelUI = GameObject.FindObjectOfType <VideoPanel>();
     videoPanelUI.SetResolution(640, 480);
 }