public Projection(PXCMSession session, PXCMCapture.Device device, PXCMImage.ImageInfo dinfo, PXCMImage.ImageInfo cinfo)
        {
            /* retrieve the invalid depth pixel values */
            invalid_value = device.QueryDepthLowConfidenceValue();

            /* Create the projection instance */
            projection = device.CreateProjection();

            uvmap = new PXCMPointF32[dinfo.width * dinfo.height];
            invuvmap = new PXCMPointF32[cinfo.width * cinfo.height];
        }
        public Projection(PXCMSession session, PXCMCapture.Device device, PXCMImage.ImageInfo dinfo)
        {
            //: start ros serial node:
//            rosPublisher.start("192.168.0.10");

            /* Create the projection instance */
            projection = device.CreateProjection();

            height = dinfo.height;
            width = dinfo.width;
            numOfPixels = dinfo.width * dinfo.height;
            UInt16 invalid_value = device.QueryDepthLowConfidenceValue();
            obj_detector = new managed_obj_detector.ObjDetector(dinfo.width, dinfo.height, invalid_value);
            coords = new PXCMPoint3DF32[numOfPixels];
            rgb_ir_d_xyz_points = new managed_obj_detector.RgbIrDXyzPoint[numOfPixels];
        }
        public static DS4CalibrationRecord Calibrate(PXCMCapture.Device device)
        {
            PXCMProjection projection = device.CreateProjection();
            /* Get a calibration instance */
            PXCMCalibration calib = projection.QueryInstance<PXCMCalibration>();
            PXCMCalibration.StreamCalibration calibration;
            PXCMCalibration.StreamTransform transformation;

            calib.QueryStreamProjectionParameters(PXCMCapture.StreamType.STREAM_TYPE_COLOR, out calibration, out transformation);

            float[] translation = transformation.translation;

            DS4CalibrationRecord record = new DS4CalibrationRecord
            {
                DeviceCapture = new DS4CalibrationRecordInternal
                {
                    ColorFocalLength = device.QueryColorFocalLength().toFloatArray(),
                    DepthFocalLength = device.QueryDepthFocalLength().toFloatArray(),

                    ColorFOV = device.QueryColorFieldOfView().toFloatArray(),
                    DepthFOV = device.QueryDepthFieldOfView().toFloatArray(),

                    ColorPrincipalPoint = device.QueryColorPrincipalPoint().toFloatArray(),
                    DepthPrincipalPoint = device.QueryDepthPrincipalPoint().toFloatArray(),

                    ColorWidth = Frame.COLOR_WIDTH,
                    ColorHeight = Frame.COLOR_HEIGHT,

                    DepthWidth = Frame.DEPTH_WIDTH,
                    DepthHeight = Frame.DEPTH_HEIGHT,
                    DepthStride = Frame.DEPTH_STRIDE,

                    LowConfValue = device.QueryDepthLowConfidenceValue(),

                    Extrinsics = new float[] {  1.0f,
                                            0.0f,
                                            0.0f,
                                            translation[0],
                                            0.0f,
                                            1.0f,
                                            0.0f,
                                            translation[1],
                                            0.0f,
                                            0.0f,
                                            1.0f,
                                            translation[2],
                                            0.0f,
                                            0.0f,
                                            0.0f,
                                            1.0f}

                },

                API = "RSSDK"
            };

            return record;
        }