Beispiel #1
0
        private void SelectHardwareAndStreamProfile()
        {
            SelectedIntelRealSenseCamera = CameraService.GetIntelRealSenseSR300();
            if (SelectedIntelRealSenseCamera == null)
            {
                throw new Exception("Intel RealSense Camera not connected!");
            }

            SelectedResolution_ColorDepth_FrameRateCombination = CameraService.GetResolution_ColorDepth_FrameRateCombination(SelectedIntelRealSenseCamera);
            if (SelectedResolution_ColorDepth_FrameRateCombination == null)
            {
                throw new Exception("Resolution_ColorDepth_FrameRateCombination not supported");
            }

            SenseManager   = Session.CreateSenseManager();
            CaptureManager = SenseManager.captureManager;
            CaptureManager.FilterByDeviceInfo(SelectedIntelRealSenseCamera.Device.deviceInfo);

            var streamFrofileSet = new PXCMCapture.Device.StreamProfileSet
            {
                color =
                {
                    frameRate = SelectedResolution_ColorDepth_FrameRateCombination.FrameRate,
                    imageInfo =
                    {
                        format = SelectedResolution_ColorDepth_FrameRateCombination.PixelFormat,
                        height = SelectedResolution_ColorDepth_FrameRateCombination.Height,
                        width  = SelectedResolution_ColorDepth_FrameRateCombination.Width
                    }
                }
            };

            CaptureManager.FilterByStreamProfiles(streamFrofileSet);
        }
        private List <Resolution_ColorDepth_FrameRateCombination> GetResolution_ColorDepth_FrameRate_Combinations(PXCMCapture.Device device)
        {
            var deviceResolutions = new List <Resolution_ColorDepth_FrameRateCombination>();

            for (int k = 0; k < device.QueryStreamProfileSetNum(PXCMCapture.StreamType.STREAM_TYPE_COLOR); k++)
            {
                PXCMCapture.Device.StreamProfileSet profileSet;
                device.QueryStreamProfileSet(PXCMCapture.StreamType.STREAM_TYPE_COLOR, k, out profileSet);

                var currentRes = new Resolution_ColorDepth_FrameRateCombination(profileSet.color.imageInfo, profileSet.color.frameRate);

                if (IsProfileSupported(profileSet, device.deviceInfo))
                {
                    continue;
                }
                //Filter only supported Resolutions
                if (supportedColorResolutions.Contains(new Tuple <int, int>(currentRes.Width, currentRes.Height)))
                {
                    deviceResolutions.Add(currentRes);
                }
            }

            return(deviceResolutions);
        }