Exemple #1
0
        public async void StartPreview(OnPreviewStartedCallback onPreviewStartedCallback)
        {
            await VideoCapture.CreateAync(v => videoCapture = v);

            if (videoCapture == null)
            {
                Debug.Write("Did not find a video capture object. You may not be using the HoloLens.");
                return;
            }

            _resolution = GetLowestResolution();
            float frameRate = 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.
            CameraParameters cameraParams = new CameraParameters();

            cameraParams.cameraResolutionHeight = _resolution.height;
            cameraParams.cameraResolutionWidth  = _resolution.width;
            cameraParams.frameRate             = (int)Math.Round(frameRate);
            cameraParams.pixelFormat           = CapturePixelFormat.BGRA32;
            cameraParams.rotateImage180Degrees = false; //If your image is upside down, remove this line.
            cameraParams.enableHolograms       = false;

            videoCapture.StartVideoModeAsync(cameraParams, (result) =>
            {
                if (!result.success)
                {
                    throw new Exception("Starting Video Mode failed");
                }
                onPreviewStartedCallback.Invoke();
            });
        }
Exemple #2
0
    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogError("Cannot create two instances of CamStreamManager.");
            return;
        }

        instance = this;
        VideoCapture.CreateAync(/*26n si es mio, lo deje a medias, false *//*achtung, wont show holograms ,*/ OnVideoCaptureInstanceCreated);
    }
    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogError("Cannot create two instances of CamStreamManager.");
            return;
        }

        instance = this;
        VideoCapture.CreateAync(OnVideoCaptureInstanceCreated);
    }
Exemple #4
0
 private void CreateVideoCaptureInstance()
 {
     VideoCapture.CreateAync(OnVideoCaptureInstanceCreated);
 }
Exemple #5
0
 void Start()
 {
     VideoCapture.CreateAync(OnCreatedCallback);
 }