pxcmStatus OnModuleProcessedFrame( int mid, PXCMBase module, PXCMCapture.Sample sample) { // is it our module? if (mid == PXCMFaceModule.CUID) { this.faceData.Update(); // Any faces? var firstFace = this.faceData.QueryFaces().FirstOrDefault(); if (firstFace != null) { // face detection - the bounding rectangle of the face. var localFaceBox = default(PXCMRectI32); if (firstFace.QueryDetection()?.QueryBoundingRect(out localFaceBox) == true) { this.faceBox = localFaceBox; } var landmarks = firstFace.QueryLandmarks()?.QueryPoints( out this.landmarks); } else { this.faceBox = null; this.landmarks = null; } } this.Dispatcher.Invoke(this.DrawFaceFrameUIThread); return (pxcmStatus.PXCM_STATUS_NO_ERROR); }
private void ElaborateSample(PXCMCapture.Sample sample, IEnumerable<PXCMFaceData.Face> faces) { if (sample == null) return; WriteableBitmap imageRGB = null; if (sample.color != null) { imageRGB =sample.color.GetImage(); } if (faces != null && faces.Any()) { for (int i = 0; i < faces.Count(); i++) { var face = faces.ElementAt(i); PXCMFaceData.DetectionData detectionData = face.QueryDetection(); PXCMRectI32 faceBound; if (detectionData != null && detectionData.QueryBoundingRect(out faceBound)) { imageRGB.DrawRectangle(faceBound.x, faceBound.y, faceBound.x + faceBound.w, faceBound.y + faceBound.h, GetColorByIndex(i), 4); } } } if (imageRGB != null) imageRGB.Freeze(); Dispatcher.Invoke(() => { this.ImageRGB = imageRGB; }); }
private pxcmStatus OnConnect(PXCMCapture.Device device, bool connected) { Dispatcher.Invoke(() => sensorbutton.Content = "Deactivate Sensor"); return pxcmStatus.PXCM_STATUS_NO_ERROR; }
public MainForm(PXCMSession session) { InitializeComponent(); /* Put stream menu items to array */ streamMenus[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_COLOR)] = ColorMenu; streamMenus[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_DEPTH)] = DepthMenu; streamMenus[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_IR)] = IRMenu; streamMenus[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_LEFT)] = LeftMenu; streamMenus[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_RIGHT)] = RightMenu; /* Put stream buttons to array */ streamButtons[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_COLOR)] = Color; streamButtons[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_DEPTH)] = Depth; streamButtons[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_IR)] = IR; streamButtons[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_LEFT)] = IRLeft; streamButtons[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_RIGHT)] = IRRight; /* Put panels buttons to array */ streamPanels[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_COLOR)] = ColorPanel; streamPanels[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_DEPTH)] = DepthPanel; streamPanels[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_IR)] = IRPanel; streamPanels[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_LEFT)] = IRLeftPanel; streamPanels[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_RIGHT)] = IRRightPanel; this.session = session; streaming.UpdateStatus += new EventHandler <UpdateStatusEventArgs>(UpdateStatusHandler); streaming.RenderFrame += new EventHandler <RenderFrameEventArgs>(RenderFrameHandler); FormClosing += new FormClosingEventHandler(FormClosingHandler); ColorPanel.Paint += new PaintEventHandler(PaintHandler); DepthPanel.Paint += new PaintEventHandler(PaintHandler); IRPanel.Paint += new PaintEventHandler(PaintHandler); IRLeftPanel.Paint += new PaintEventHandler(PaintHandler); IRRightPanel.Paint += new PaintEventHandler(PaintHandler); ColorPanel.Resize += new EventHandler(ResizeHandler); DepthPanel.Resize += new EventHandler(ResizeHandler); IRPanel.Resize += new EventHandler(ResizeHandler); IRLeftPanel.Resize += new EventHandler(ResizeHandler); IRRightPanel.Resize += new EventHandler(ResizeHandler); ResetStreamTypes(); PopulateDeviceMenu(); Scale2.CheckedChanged += new EventHandler(Scale_Checked); Mirror.CheckedChanged += new EventHandler(Mirror_Checked); foreach (RadioButton button in streamButtons) { if (button != null) { button.Click += new EventHandler(Stream_Click); } } renders[0].SetHWND(ColorPanel); renders[1].SetHWND(DepthPanel); renders[2].SetHWND(IRPanel); renders[3].SetHWND(IRLeftPanel); renders[4].SetHWND(IRRightPanel); }
/// <summary> /// Device-specific implementation of Connect. /// Connects the camera. /// </summary> /// <remarks>This method is implicitely called by <see cref="Camera.Connect"/> inside a camera lock.</remarks> /// <seealso cref="Camera.Connect"/> protected override void ConnectImpl() { if (deviceInfo.Count == 0) { ScanForCameras(); } if (deviceInfo.Count == 0) { log.Error(Name + "No device found."); return; } int deviceIndex = 0; ScanForProfiles(deviceIndex); /* Create an instance of the PXCSenseManager interface */ pp = PXCMSenseManager.CreateInstance(); if (pp == null) { log.Error(Name + "Failed to create an SDK pipeline object"); return; } pp.captureManager.FilterByDeviceInfo(deviceInfo[deviceIndex]); //TODO: change this to work with properties currentColorProfile = "YUY2 1920x1080x30"; currentDepthProfile = "DEPTH 640x480x60"; currentIRProfile = "Y8 640x480x60"; PXCMCapture.Device.StreamProfileSet currentProfileSet = new PXCMCapture.Device.StreamProfileSet(); currentProfileSet[PXCMCapture.StreamType.STREAM_TYPE_COLOR] = profiles[currentColorProfile]; currentProfileSet[PXCMCapture.StreamType.STREAM_TYPE_DEPTH] = profiles[currentDepthProfile]; currentProfileSet[PXCMCapture.StreamType.STREAM_TYPE_IR] = profiles[currentIRProfile]; /* Set Color & Depth Resolution */ for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s); PXCMCapture.Device.StreamProfile info = currentProfileSet[st]; if (info.imageInfo.format != 0) { Single fps = info.frameRate.max; pp.EnableStream(st, info.imageInfo.width, info.imageInfo.height, fps); } } if (pp.Init() >= pxcmStatus.PXCM_STATUS_NO_ERROR) { } else { log.Error(Name + "An error occured."); } ActivateChannel(ChannelNames.Intensity); ActivateChannel(ChannelNames.ZImage); }
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; }
public static PXCMCapture.Device.PropertyInfo[] ReadPropInfo(PXCMCapture.Device device) { PXCMCapture.Device.PropertyInfo[] propInfo = new PXCMCapture.Device.PropertyInfo[5]; propInfo[0] = device.QueryDepthConfidenceThresholdInfo(); propInfo[1] = new PXCMCapture.Device.PropertyInfo() { range = { min = 0, max = 2 } }; //device.QueryIVCAMAccuracy(); propInfo[2] = device.QueryIVCAMFilterOptionInfo(); propInfo[3] = device.QueryIVCAMLaserPowerInfo(); propInfo[4] = device.QueryIVCAMMotionRangeTradeOffInfo(); return propInfo; }
private PXCMCapture.StreamType GetStreamAvailable(PXCMCapture.StreamType stream) { if (streamMenus[PXCMCapture.StreamTypeToIndex(stream)] != null && streamMenus[PXCMCapture.StreamTypeToIndex(stream)].Available == true) { return(stream); } return(PXCMCapture.StreamType.STREAM_TYPE_ANY); }
private PXCMCapture.Device.StreamProfileSet GetStreamSetConfiguration() { PXCMCapture.Device.StreamProfileSet profiles = new PXCMCapture.Device.StreamProfileSet(); for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s); profiles[st] = GetStreamConfiguration(st); } return(profiles); }
private void CheckSelection() { PXCMCapture.Device.StreamProfile dprofile = GetDepthConfiguration(); //?DepthNone.Enabled = (cprofile.imageInfo.format != 0 || irprofile.imageInfo.format != 0); PXCMSession.ImplDesc desc = new PXCMSession.ImplDesc(); desc.group = PXCMSession.ImplGroup.IMPL_GROUP_SENSOR; desc.subgroup = PXCMSession.ImplSubgroup.IMPL_SUBGROUP_VIDEO_CAPTURE; desc.iuid = current_device_iuid; desc.cuids[0] = PXCMCapture.CUID; PXCMCapture capture; PXCMCapture.DeviceInfo dinfo2 = GetCheckedDevice(); if (session.CreateImpl <PXCMCapture>(desc, out capture) >= pxcmStatus.PXCM_STATUS_NO_ERROR) { using (capture) { using (PXCMCapture.Device device = capture.CreateDevice(dinfo2.didx)) { if (device != null) { PXCMCapture.Device.StreamProfileSet profile = new PXCMCapture.Device.StreamProfileSet(); PXCMCapture.Device.StreamProfileSet test = new PXCMCapture.Device.StreamProfileSet(); /* Loop over all stream types and profiles and enable only compatible in menu */ for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s); if (((int)dinfo2.streams & (int)PXCMCapture.StreamType.STREAM_TYPE_COLOR) != 0) { //?test[PXCMCapture.StreamType.STREAM_TYPE_COLOR] = cprofile; test[PXCMCapture.StreamType.STREAM_TYPE_DEPTH] = dprofile; //?test[PXCMCapture.StreamType.STREAM_TYPE_IR] = irprofile; int num = device.QueryStreamProfileSetNum(st); for (int p = 0; p < num; p++) { if (device.QueryStreamProfileSet(st, p, out profile) < pxcmStatus.PXCM_STATUS_NO_ERROR) { break; } PXCMCapture.Device.StreamProfile sprofile = profile[st]; ToolStripMenuItem sm1 = GetMenuItem(sprofile); if (sm1 != null) { test[st] = sprofile; sm1.Enabled = device.IsStreamProfileSetValid(test); } } } } } } } } }
public static CameraSettings ReadFrom(PXCMCapture.Device device) { CameraSettings result = new CameraSettings(); result.DepthConfidenceThreshold = device.QueryDepthConfidenceThreshold(); result.IVCAMAccuracy = (int)device.QueryIVCAMAccuracy(); result.IVCAMFilterOption = device.QueryIVCAMFilterOption(); result.IVCAMLaserPower = device.QueryIVCAMLaserPower(); result.IVCAMMotionRangeTradeOff = device.QueryIVCAMMotionRangeTradeOff(); result.changed = false; return result; }
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]; }
private PXCMCapture.StreamType GetUnselectedStream() { for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { if (streamButtons[s] != null && !streamButtons[s].Checked && streamButtons[s].Enabled) { return(PXCMCapture.StreamTypeFromIndex(s)); } } return(PXCMCapture.StreamType.STREAM_TYPE_ANY); }
private void OnSample(PXCMCapture.Sample sample) { if (m_shuttingDown) return; lock (this) { if (m_sample != null) m_sample.Dispose(); m_sample = sample.color; m_sample.QueryInstance<PXCMAddRef>().AddRef(); } }
public static CameraSettings ReadDefaultFrom(PXCMCapture.Device device) { CameraSettings result = new CameraSettings(); result.DepthConfidenceThreshold = (ushort)device.QueryDepthConfidenceThresholdInfo().defaultValue; result.IVCAMAccuracy = (int)device.QueryIVCAMAccuracyDefaultValue(); result.IVCAMFilterOption = (int)device.QueryIVCAMFilterOptionInfo().defaultValue; result.IVCAMLaserPower = (int)device.QueryIVCAMLaserPowerInfo().defaultValue; result.IVCAMMotionRangeTradeOff = (int)device.QueryIVCAMMotionRangeTradeOffInfo().defaultValue; result.changed = true; return result; }
private PXCMCapture.Device.StreamProfile GetStreamConfiguration(PXCMCapture.StreamType st) { ToolStripMenuItem menu = streamMenus[PXCMCapture.StreamTypeToIndex(st)]; if (menu != null) { return(GetConfiguration(menu)); } else { return(new PXCMCapture.Device.StreamProfile()); } }
public void WriteTo(PXCMCapture.Device device, CameraSettings oldSettings) { if (oldSettings.DepthConfidenceThreshold != DepthConfidenceThreshold) device.SetDepthConfidenceThreshold(DepthConfidenceThreshold); if (oldSettings.IVCAMAccuracy != IVCAMAccuracy) device.SetIVCAMAccuracy((PXCMCapture.Device.IVCAMAccuracy)IVCAMAccuracy); if (oldSettings.IVCAMFilterOption != IVCAMFilterOption) device.SetIVCAMFilterOption(IVCAMFilterOption); if (oldSettings.IVCAMLaserPower != IVCAMLaserPower) device.SetIVCAMLaserPower(IVCAMLaserPower); if (oldSettings.IVCAMMotionRangeTradeOff != IVCAMMotionRangeTradeOff) device.SetIVCAMMotionRangeTradeOff(IVCAMMotionRangeTradeOff); this.changed = false; }
static void enumDevice(PXCMCapture capture) { for (int i = 0; ; ++i) { // デバイス情報を取得する PXCMCapture.DeviceInfo dinfo; var sts = capture.QueryDeviceInfo(i, out dinfo); if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR) { break; } // デバイス名を表示する Console.WriteLine("\t" + dinfo.name); // デバイスを取得する var device = capture.CreateDevice(i); for (int s = 0; s < PXCMCapture.STREAM_LIMIT; ++s) { // ストリーム種別を取得する PXCMCapture.StreamType type = PXCMCapture.StreamTypeFromIndex(s); if ((dinfo.streams & type) == 0) { continue; } // ストリーム名を取得する var name = PXCMCapture.StreamTypeToString(type); Console.WriteLine("\t\t" + name); // ストリームのフォーマットを取得する int nprofiles = device.QueryStreamProfileSetNum(type); for (int p = 0; p < nprofiles; ++p) { PXCMCapture.Device.StreamProfileSet profiles; sts = device.QueryStreamProfileSet(type, p, out profiles); if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR) { break; } // ストリームのフォーマットを表示する Console.WriteLine("\t\t\t" + ProfileToString(profiles[type])); } } } Console.WriteLine(""); }
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]; }
private ToolStripMenuItem GetMenuItem(PXCMCapture.StreamType st, PXCMCapture.Device.StreamProfile profile) { ToolStripMenuItem parent = streamMenus[PXCMCapture.StreamTypeToIndex(st)]; if (parent == null) { return(null); } foreach (ToolStripMenuItem key1 in parent.DropDownItems) { PXCMCapture.Device.StreamProfile profile1 = profiles[key1]; if (ProfileToString(profile1) == ProfileToString(profile)) { return(key1); } } return(null); }
static void enumDevice( PXCMCapture capture ) { for ( int i = 0; ; ++i ) { // デバイス情報を取得する PXCMCapture.DeviceInfo dinfo; var sts = capture.QueryDeviceInfo( i, out dinfo ); if ( sts < pxcmStatus.PXCM_STATUS_NO_ERROR ) { break; } // デバイス名を表示する Console.WriteLine( "\t" + dinfo.name ); // デバイスを取得する var device = capture.CreateDevice( i ); for ( int s = 0; s < PXCMCapture.STREAM_LIMIT; ++s ) { // ストリーム種別を取得する PXCMCapture.StreamType type = PXCMCapture.StreamTypeFromIndex( s ); if ( (dinfo.streams & type) == 0 ) { continue; } // ストリーム名を取得する var name = PXCMCapture.StreamTypeToString( type ); Console.WriteLine( "\t\t" + name ); // ストリームのフォーマットを取得する int nprofiles = device.QueryStreamProfileSetNum( type ); for ( int p = 0; p<nprofiles; ++p ) { PXCMCapture.Device.StreamProfileSet profiles; sts = device.QueryStreamProfileSet( type, p, out profiles ); if ( sts < pxcmStatus.PXCM_STATUS_NO_ERROR ) { break; } // ストリームのフォーマットを表示する Console.WriteLine( "\t\t\t" + ProfileToString( profiles[type] ) ); } } } Console.WriteLine( "" ); }
static void enumDevice() { // セッションを取得する var session = senseManager.QuerySession(); if (session == null) { throw new Exception("セッションの取得に失敗しました"); } // 取得するグループを設定する PXCMSession.ImplDesc mdesc = new PXCMSession.ImplDesc(); mdesc.group = PXCMSession.ImplGroup.IMPL_GROUP_SENSOR; mdesc.subgroup = PXCMSession.ImplSubgroup.IMPL_SUBGROUP_VIDEO_CAPTURE; for (int i = 0; ; ++i) { // センサーグループを取得する PXCMSession.ImplDesc desc1; var sts = session.QueryImpl(mdesc, i, out desc1); if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR) { break; } // センサーグループ名を表示する Console.WriteLine(desc1.friendlyName); // キャプチャーオブジェクトを作成する PXCMCapture capture = null; sts = session.CreateImpl <PXCMCapture>(desc1, out capture); if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR) { continue; } // デバイスを列挙する enumDevice(capture); // キャプチャーオブジェクトを解放する capture.Dispose(); } }
public void SearchForObject(PXCMCapture.Sample sample, managed_obj_detector.ProcessParams processParams) { //////if (processParams.qualityEstimationMethod == managed_obj_detector.QualityEstimationMethod.DepthChange) //////{ ////// this.computePixelQualityFromDepth(sample.depth); //////} //////else if (processParams.qualityEstimationMethod == managed_obj_detector.QualityEstimationMethod.DepthClusters) //////{ ////// this.depthToScan(sample.depth); ////// this.computePixelQualityFromDepthClusters(sample.depth, processParams); //////} //////else if (processParams.qualityEstimationMethod == managed_obj_detector.QualityEstimationMethod.ColorClusters) //////{ this.computePixelQualityFromClusters(sample, processParams); //////} //////else //////{ ////// this.depthToScan(sample.depth); ////// this.computePixelQualityFromNormals(processParams); //////} }
private void ElaborateSample(PXCMCapture.Sample sample, PXCMFaceData.Face face) { if (sample == null) return; WriteableBitmap imageRGB = null; if (sample.color != null) { imageRGB = sample.color.GetImage(); } if (face != null) { PXCMFaceData.LandmarksData landmarkData = face.QueryLandmarks(); PXCMFaceData.LandmarkPoint[] landmarkPoints = null; if (landmarkData.QueryPoints(out landmarkPoints)) { foreach (var point in landmarkPoints) { if (point.confidenceImage > 50) if (point.source.alias != PXCMFaceData.LandmarkType.LANDMARK_NOT_NAMED) imageRGB.FillEllipseCentered((int)point.image.x, (int)point.image.y, 4, 4, Colors.White); else imageRGB.FillEllipseCentered((int)point.image.x, (int)point.image.y, 4, 4, Colors.Yellow); } } } if (imageRGB != null) imageRGB.Freeze(); Dispatcher.Invoke(() => { this.ImageRGB = imageRGB; }); Process.GetCurrentProcess(); }
private void CheckForDepthStream(PXCMCapture.Device.StreamProfileSet profiles, PXCMFaceModule faceModule) { PXCMFaceConfiguration faceConfiguration = faceModule.CreateActiveConfiguration(); if (faceConfiguration == null) { Debug.Assert(faceConfiguration != null); return; } PXCMFaceConfiguration.TrackingModeType trackingMode = faceConfiguration.GetTrackingMode(); faceConfiguration.Dispose(); //change if (trackingMode != PXCMFaceConfiguration.TrackingModeType.FACE_MODE_COLOR_PLUS_DEPTH) return; if (profiles.depth.imageInfo.format == PXCMImage.PixelFormat.PIXEL_FORMAT_DEPTH) return; PXCMCapture.DeviceInfo dinfo; m_form.Devices.TryGetValue(m_form.GetCheckedDevice(), out dinfo); if (dinfo != null) MessageBox.Show( String.Format("Depth stream is not supported for device: {0}. \nUsing 2D tracking", dinfo.name), @"Face Tracking", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private static extern bool SetDevicePropertyC(IntPtr pp, PXCMCapture.Device.Property pty, int npty, IntPtr data);
public static pxcmStatus OnNewFrame(Int32 mid, PXCMBase module, PXCMCapture.Sample sample) { return pxcmStatus.PXCM_STATUS_NO_ERROR; }
public bool SetDeviceProperty(PXCMCapture.Device.Property pty, float[] data) { if (instance==IntPtr.Zero) return false; GCHandle dataHandle = GCHandle.Alloc(data, GCHandleType.Pinned); bool sts = SetDevicePropertyC(instance, pty, data.Length, dataHandle.AddrOfPinnedObject()); dataHandle.Free(); return sts; }
internal string PropertyInfoToString(String pName, PXCMCapture.Device.PropertyInfo pInfo) { return pName + " \t" + "auto:" + pInfo.automatic.ToString() + " default:" + pInfo.defaultValue.ToString() + " range:" + pInfo.range.min.ToString() + ".." + pInfo.range.max.ToString() + " step:" + pInfo.step.ToString(); }
private static bool IsProfileSupported(PXCMCapture.Device.StreamProfileSet profileSet, PXCMCapture.DeviceInfo dinfo) { return (profileSet.color.frameRate.min < 30) || (dinfo != null && dinfo.model == PXCMCapture.DeviceModel.DEVICE_MODEL_DS4 && (profileSet.color.imageInfo.width == 1920 || profileSet.color.frameRate.min > 30 || profileSet.color.imageInfo.format == PXCMImage.PixelFormat.PIXEL_FORMAT_YUY2)) || (profileSet.color.options == PXCMCapture.Device.StreamOption.STREAM_OPTION_UNRECTIFIED); }
internal void SetCameraSettings(CameraSettings cs, PXCMCapture.Device.PropertyInfo[] propInfo) { this.cameraSettings = cs; this.Invoke( new UpdateFromOtherThreadDelegate( delegate() { cameraSettings.SetupTrackBars(this.cameraSettingsTrackBars, propInfo); } ) ); }
private ToolStripMenuItem GetMenuItem(PXCMCapture.Device.StreamProfile profile) { foreach (ToolStripMenuItem key1 in profiles.Keys) { PXCMCapture.Device.StreamProfile profile1 = profiles[key1]; if (ProfileToString(profile1) == ProfileToString(profile)) return key1; } return null; }
public NewImageArgs(PXCMCapture.StreamType streamType, System.Drawing.Bitmap bitmap) { Bitmap = bitmap; StreamType = streamType; }
private void CheckSelection() { if (!ModePlayback.Checked) { PXCMCapture.Device.StreamProfileSet allProfile = new PXCMCapture.Device.StreamProfileSet(); for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s); allProfile[st] = GetStreamConfiguration(st); } PXCMSession.ImplDesc desc = new PXCMSession.ImplDesc(); desc.group = PXCMSession.ImplGroup.IMPL_GROUP_SENSOR; desc.subgroup = PXCMSession.ImplSubgroup.IMPL_SUBGROUP_VIDEO_CAPTURE; desc.iuid = current_device_iuid; desc.cuids[0] = PXCMCapture.CUID; PXCMCapture capture; PXCMCapture.DeviceInfo dinfo2 = GetCheckedDevice(); if (session.CreateImpl <PXCMCapture>(desc, out capture) >= pxcmStatus.PXCM_STATUS_NO_ERROR) { PXCMCapture.Device device = capture.CreateDevice(dinfo2.didx); if (device != null) { PXCMCapture.Device.StreamProfileSet profile = new PXCMCapture.Device.StreamProfileSet(); PXCMCapture.Device.StreamProfileSet test = new PXCMCapture.Device.StreamProfileSet(); /* Loop over all stream types and profiles and enable only compatible in menu */ for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s); if (((int)dinfo2.streams & (int)st) != 0) { for (int s1 = 0; s1 < PXCMCapture.STREAM_LIMIT; s1++) { test[PXCMCapture.StreamTypeFromIndex(s1)] = allProfile[PXCMCapture.StreamTypeFromIndex(s1)]; } int num = device.QueryStreamProfileSetNum(st); for (int p = 0; p < num; p++) { if (device.QueryStreamProfileSet(st, p, out profile) < pxcmStatus.PXCM_STATUS_NO_ERROR) { break; } PXCMCapture.Device.StreamProfile sprofile = profile[st]; ToolStripMenuItem sm1 = GetMenuItem(st, sprofile); if (sm1 != null) { test[st] = sprofile; sm1.Enabled = device.IsStreamProfileSetValid(test); } } } } Start.Enabled = device.IsStreamProfileSetValid(allProfile); device.Dispose(); } capture.Dispose(); } } int sumEnabled = 0; for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { if (streamButtons[s] != null && streamNone[s] != null) { streamButtons[s].Enabled = !streamNone[s].Checked; sumEnabled += streamButtons[s].Enabled?1:0; } } PIP.Enabled = (sumEnabled >= 2); Mirror.Enabled = !ModePlayback.Checked; PXCMCapture.StreamType selectedStream = GetSelectedStream(); if (selectedStream != PXCMCapture.StreamType.STREAM_TYPE_ANY && !streamButtons[PXCMCapture.StreamTypeToIndex(selectedStream)].Enabled) { PXCMCapture.StreamType st = GetUnselectedStream(); streamButtons[PXCMCapture.StreamTypeToIndex(st)].Checked = true; streaming.ColorPanel = st; } //if (PIP.Enabled && streaming.DepthPanel == PXCMCapture.StreamType.STREAM_TYPE_ANY) //{ // streaming.DepthPanel = GetUnselectedStream(); //} }
private void ElaborateSample(PXCMCapture.Sample sample, PXCMFaceData.Face face) { if (sample == null) return; WriteableBitmap imageRGB = null; bool isPoseVisible = false; float pitchValue = 0, yawValue = 0, rollValue = 0; if (sample.color != null) { imageRGB = sample.color.GetImage(); } if (face != null) { PXCMFaceData.PoseData poseData = face.QueryPose(); PXCMFaceData.PoseEulerAngles poseAngles; if (poseData.QueryPoseAngles(out poseAngles)) { isPoseVisible = true; pitchValue = poseAngles.pitch; yawValue = poseAngles.yaw; rollValue = poseAngles.roll; } } if (imageRGB != null) imageRGB.Freeze(); Dispatcher.Invoke(() => { this.ImageRGB = imageRGB; this.IsPoseVisible = isPoseVisible; this.Pitch = pitchValue; this.Roll = rollValue; this.Yaw = yawValue; }); }
public RealSenseImageStream(PXCMCapture.StreamType streamType) { StreamType = streamType; }
public void SetupTrackBars(System.Windows.Forms.TrackBar[] tb, PXCMCapture.Device.PropertyInfo[] propInfo) { for (int i = 0; i < 5; ++i) { tb[i].Minimum = (int)propInfo[i].range.min; tb[i].Maximum = (int)propInfo[i].range.max; } SetupTrackBars(tb); }
private void PopulateColorDepthMenus(ToolStripMenuItem device_item) { PXCMSession.ImplDesc desc = new PXCMSession.ImplDesc(); desc.group = PXCMSession.ImplGroup.IMPL_GROUP_SENSOR; desc.subgroup = PXCMSession.ImplSubgroup.IMPL_SUBGROUP_VIDEO_CAPTURE; desc.iuid = devices_iuid[device_item]; current_device_iuid = desc.iuid; desc.cuids[0] = PXCMCapture.CUID; profiles.Clear(); foreach (ToolStripMenuItem menu in streamMenus) { if (menu != null) { menu.DropDownItems.Clear(); } } PXCMCapture capture; PXCMCapture.DeviceInfo dinfo2 = GetCheckedDevice(); if (session.CreateImpl <PXCMCapture>(desc, out capture) >= pxcmStatus.PXCM_STATUS_NO_ERROR) { PXCMCapture.Device device = capture.CreateDevice(dinfo2.didx); if (device != null) { PXCMCapture.Device.StreamProfileSet profile = new PXCMCapture.Device.StreamProfileSet(); for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s); if (((int)dinfo2.streams & (int)st) != 0 && streamMenus[s] != null) { streamMenus[s].Visible = true; streamButtons[s].Visible = true; streamPanels[s].Visible = true; int num = device.QueryStreamProfileSetNum(st); for (int p = 0; p < num; p++) { if (device.QueryStreamProfileSet(st, p, out profile) < pxcmStatus.PXCM_STATUS_NO_ERROR) { break; } PXCMCapture.Device.StreamProfile sprofile = profile[st]; ToolStripMenuItem sm1 = new ToolStripMenuItem(ProfileToString(sprofile), null, new EventHandler(Stream_Item_Click)); profiles[sm1] = sprofile; streamMenus[s].DropDownItems.Add(sm1); if (sm1.Text.Contains(default_config[s])) { default_menu[s] = p; Debug.WriteLine(s + " : " + p + " : " + ProfileToString(sprofile)); } } } else if (((int)dinfo2.streams & (int)st) == 0 && streamMenus[s] != null) { streamMenus[s].Visible = false; streamButtons[s].Visible = false; streamPanels[s].Visible = false; } } device.Dispose(); } capture.Dispose(); } for (int i = 0; i < PXCMCapture.STREAM_LIMIT; i++) { ToolStripMenuItem menu = streamMenus[i]; if (menu != null) { streamNone[i] = new ToolStripMenuItem("None", null, new EventHandler(Stream_Item_Click)); profiles[streamNone[i]] = new PXCMCapture.Device.StreamProfile(); menu.DropDownItems.Add(streamNone[i]); if (default_menu[i] != 0) { (menu.DropDownItems[default_menu[i]] as ToolStripMenuItem).Checked = true; } else { streamNone[i].Checked = true; } } } CheckSelection(); }
private bool PopulateDeviceFromFileMenu() { devices.Clear(); devices_iuid.Clear(); PXCMSession.ImplDesc desc = new PXCMSession.ImplDesc(); desc.group = PXCMSession.ImplGroup.IMPL_GROUP_SENSOR; desc.subgroup = PXCMSession.ImplSubgroup.IMPL_SUBGROUP_VIDEO_CAPTURE; PXCMSession.ImplDesc desc1; PXCMCapture.DeviceInfo dinfo; PXCMSenseManager pp = PXCMSenseManager.CreateInstance(); if (pp == null) { SetStatus("Init Failed"); return(false); } try { if (session.QueryImpl(desc, 0, out desc1) < pxcmStatus.PXCM_STATUS_NO_ERROR) { throw null; } if (pp.captureManager.SetFileName(streaming.File, false) < pxcmStatus.PXCM_STATUS_NO_ERROR) { throw null; } if (pp.captureManager.LocateStreams() < pxcmStatus.PXCM_STATUS_NO_ERROR) { throw null; } pp.captureManager.device.QueryDeviceInfo(out dinfo); } catch { pp.Dispose(); SetStatus("Init Failed"); return(false); } DeviceMenu.DropDownItems.Clear(); ToolStripMenuItem sm1 = new ToolStripMenuItem(dinfo.name, null, new EventHandler(Device_Item_Click)); devices[sm1] = dinfo; devices_iuid[sm1] = desc1.iuid; DeviceMenu.DropDownItems.Add(sm1); sm1 = new ToolStripMenuItem("playback from the file : ", null); sm1.Enabled = false; DeviceMenu.DropDownItems.Add(sm1); sm1 = new ToolStripMenuItem(streaming.File, null); sm1.Enabled = false; DeviceMenu.DropDownItems.Add(sm1); if (DeviceMenu.DropDownItems.Count > 0) { (DeviceMenu.DropDownItems[0] as ToolStripMenuItem).Checked = true; } /* populate profile menus from the file */ profiles.Clear(); foreach (ToolStripMenuItem menu in streamMenus) { if (menu != null) { menu.DropDownItems.Clear(); } } PXCMCapture.Device device = pp.captureManager.device; if (device == null) { pp.Dispose(); SetStatus("Init Failed"); return(false); } PXCMCapture.Device.StreamProfileSet profile = new PXCMCapture.Device.StreamProfileSet(); for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s); if (((int)dinfo.streams & (int)st) != 0 && streamMenus[s] != null) { streamMenus[s].Visible = true; streamButtons[s].Visible = true; streamPanels[s].Visible = true; int num = device.QueryStreamProfileSetNum(st); for (int p = 0; p < num; p++) { if (device.QueryStreamProfileSet(st, p, out profile) < pxcmStatus.PXCM_STATUS_NO_ERROR) { break; } PXCMCapture.Device.StreamProfile sprofile = profile[st]; sm1 = new ToolStripMenuItem(ProfileToString(sprofile), null, new EventHandler(Stream_Item_Click)); profiles[sm1] = sprofile; streamMenus[s].DropDownItems.Add(sm1); Debug.WriteLine("1: " + ProfileToString(sprofile)); } } else if (((int)dinfo.streams & (int)st) == 0 && streamMenus[s] != null) { streamMenus[s].Visible = false; streamButtons[s].Visible = false; streamPanels[s].Visible = false; } } for (int i = 0; i < PXCMCapture.STREAM_LIMIT; i++) { ToolStripMenuItem menu = streamMenus[i]; if (menu != null) { streamNone[i] = new ToolStripMenuItem("None", null, new EventHandler(Stream_Item_Click)); profiles[streamNone[i]] = new PXCMCapture.Device.StreamProfile(); menu.DropDownItems.Add(streamNone[i]); (menu.DropDownItems[0] as ToolStripMenuItem).Checked = true; } } Start.Enabled = true; CheckSelection(); pp.Close(); pp.Dispose(); StatusLabel.Text = "Ok"; return(true); }
public static Int32 ToIndex(this PXCMCapture.StreamType type) { return(PXCMCapture.StreamTypeToIndex(type)); }
/// <summary> /// Called when a module has processed a frame. /// </summary> /// <param name="type">The type.</param> /// <param name="module">The module.</param> /// <param name="sample">The sample.</param> /// <returns>pxcmStatus.</returns> /// <exception cref="System.NotImplementedException">Unknown type.</exception> pxcmStatus OnModuleProcessedFrame(int type, PXCMBase module, PXCMCapture.Sample sample) { // Process the frame using the appropriate callback. switch(type) { case PXCMFaceModule.CUID: OnFaceCallback(module as PXCMFaceModule); break; case PXCMEmotion.CUID: OnEmotionCallback(module as PXCMEmotion); break; default: throw new NotImplementedException("Unknown type."); } // Handle graphics. if (sample.color != null) OnColourImage(this, new EventArgs<PXCMImage>(sample.color)); if (sample.depth != null) OnDepthImage(this, new EventArgs<PXCMImage>(sample.depth)); if (sample.ir != null) OnInfraredImage(this, new EventArgs<PXCMImage>(sample.ir)); // return NO_ERROR to continue, or any error to abort. return pxcmStatus.PXCM_STATUS_NO_ERROR; }
public static String ToString(this PXCMCapture.StreamType stream) { return(PXCMCapture.StreamTypeToString(stream)); }
// System.Windows.Forms.Timer _timer; pxcmStatus OnModuleProcessedFrame(Int32 mid, PXCMBase module, PXCMCapture.Sample sample) { thread.Wait(); if (mid == PXCMHandModule.CUID) { PXCMHandModule hand = module.QueryInstance<PXCMHandModule>(); PXCMHandData handData = hand.CreateOutput(); handData.Update(); if (handData == null) { Console.WriteLine("Failed Create Output"); Console.WriteLine("That`s all..."); Console.ReadKey(); return 0; } PXCMHandData.JointData[][] nodes = new PXCMHandData.JointData[][] { new PXCMHandData.JointData[0x20], new PXCMHandData.JointData[0x20] }; int numOfHands = handData.QueryNumberOfHands(); for (int i = 0; i < numOfHands; i++) { //Get hand by time of appearence PXCMHandData.IHand IhandData; if (handData.QueryHandData(PXCMHandData.AccessOrderType.ACCESS_ORDER_BY_TIME, i, out IhandData) == pxcmStatus.PXCM_STATUS_NO_ERROR) { if (handData != null) { //Iterate Joints for (int j = 0; j < 0x20; j++) { PXCMHandData.JointData jointData; IhandData.QueryTrackedJoint((PXCMHandData.JointType)j, out jointData); nodes[i][j] = jointData; } // end iterating over joints } } } // end itrating over hands int numOfGestures = handData.QueryFiredGesturesNumber(); if (numOfGestures > 0) { for (int i = 0; i < numOfGestures; i++) { PXCMHandData.GestureData gestureData; if (handData.QueryFiredGestureData(i, out gestureData) == pxcmStatus.PXCM_STATUS_NO_ERROR) { switch (gestureData.name) { case "wave": string[] response = GET("http://168.63.82.20/api/login", "login=sbst&password=ebc1628c26f8515f81a5178a5abfcbd9").Split('\"'); response = GET("http://168.63.82.20/api/thing", @"user_id=" + response[7] + @"&token=" + response[3] + @"&did=yk5ynj69aw7z").Split('\"'); ; label1.Invoke(new Inform((s) => label1.Text = s), response[15] + " C"); logTextBox.Invoke(new Inform((s) => logTextBox.Text = s + logTextBox.Text + WindState.ToString()), "GETDATA Temperature:" + response[15] + " C" + "\n"); break; case "tap": flagLight++; if (flagLight == 2) { if (LightState == 0) LightState = 1; else LightState = 0; flagLight = 0; logTextBox.Invoke(new Inform((s) => logTextBox.Text = s + logTextBox.Text), "MAKEDATA LightState:" + LightState + " WindState:" + WindState + "\n"); } break; case "swipe_up": flagWind++; if (flagWind == 2) { if (WindState == 0) WindState = 1; else WindState = 0; flagWind = 0; logTextBox.Invoke(new Inform((s) => logTextBox.Text = s + logTextBox.Text + WindState.ToString()), "MAKEDATA LightState:" + LightState + " WindState:" + WindState + "\n"); } break; case "thumb_up": SendState++; if (SendState == 2) { if (LightState == 0) ChangeSwitch(DidLight, "501"); else ChangeSwitch(DidLight, "498"); if (WindState == 0) ChangeSwitch(DidWind, "501"); else ChangeSwitch(DidWind, "498"); logTextBox.Invoke(new Inform((s) => logTextBox.Text = s + logTextBox.Text), "SENDDATA LightState:" + LightState + " WindState:" + WindState + "\n"); //SendState = 0; } break; //textVolume.Invoke(new Inform((s) => textVolume.Text = s), vol[3].ToString("F")); //textSpeed.Invoke(new Inform((s) => textSpeed.Text = s), vol[0].ToString("F")); //textPanorama.Invoke(new Inform((s) => textPanorama.Text = s), vol[4].ToString("0.##")); //logTextBox.Invoke(new Inform((s) => logTextBox.Text = s + logTextBox.Text), DateTime.Now.ToString("hh:mm:ss") + " Gesture: V sign" + "\n"); } } } } } //Thread.Sleep(100); return pxcmStatus.PXCM_STATUS_NO_ERROR; }
public void StreamColorDepth() /* Stream Color and Depth Synchronously or Asynchronously */ { try { bool sts = true; /* Create an instance of the PXCMSenseManager interface */ PXCMSenseManager sm = PXCMSenseManager.CreateInstance(); if (sm == null) { SetStatus("Failed to create an SDK pipeline object"); return; } /* Optional: if playback or recoridng */ if ((Playback || Record) && File != null) { sm.captureManager.SetFileName(File, Record); } /* Optional: Set Input Source */ if (!Playback && DeviceInfo != null) { sm.captureManager.FilterByDeviceInfo(DeviceInfo); } /* Set Color & Depth Resolution and enable streams */ if (StreamProfileSet != null) { /* Optional: Filter the data based on the request */ sm.captureManager.FilterByStreamProfiles(StreamProfileSet); /* Enable raw data streaming for specific stream types */ for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s); PXCMCapture.Device.StreamProfile info = StreamProfileSet[st]; if (info.imageInfo.format != 0) { /* For simple request, you can also use sm.EnableStream(...) */ PXCMVideoModule.DataDesc desc = new PXCMVideoModule.DataDesc(); desc.streams[st].frameRate.min = desc.streams[st].frameRate.max = info.frameRate.max; desc.streams[st].sizeMin.height = desc.streams[st].sizeMax.height = info.imageInfo.height; desc.streams[st].sizeMin.width = desc.streams[st].sizeMax.width = info.imageInfo.width; desc.streams[st].options = info.options; sm.EnableStreams(desc); } } } /* Initialization */ Timer timer = new Timer(); timer.UpdateStatus += UpdateStatus; SetStatus("Init Started"); if (sm.Init() >= pxcmStatus.PXCM_STATUS_NO_ERROR) { /* Reset all properties */ sm.captureManager.device.ResetProperties(PXCMCapture.StreamType.STREAM_TYPE_ANY); /* Set mirror mode */ PXCMCapture.Device.MirrorMode mirror = Mirror ? PXCMCapture.Device.MirrorMode.MIRROR_MODE_HORIZONTAL : PXCMCapture.Device.MirrorMode.MIRROR_MODE_DISABLED; sm.captureManager.device.SetMirrorMode(mirror); SetStatus("Streaming"); while (!Stop) { /* Wait until a frame is ready: Synchronized or Asynchronous */ if (sm.AcquireFrame(Synced).IsError()) { break; } /* Display images */ PXCMCapture.Sample sample = sm.QuerySample(); /* Render streams */ EventHandler <RenderFrameEventArgs> render = RenderFrame; PXCMImage image = null; if (ColorPanel != PXCMCapture.StreamType.STREAM_TYPE_ANY && render != null) { image = sample[ColorPanel]; render(this, new RenderFrameEventArgs(0, image)); } if (DepthPanel != PXCMCapture.StreamType.STREAM_TYPE_ANY && render != null) { render(this, new RenderFrameEventArgs(1, sample[DepthPanel])); } if (IRPanel != PXCMCapture.StreamType.STREAM_TYPE_ANY && render != null) { render(this, new RenderFrameEventArgs(2, sample[IRPanel])); } if (IRLeftPanel != PXCMCapture.StreamType.STREAM_TYPE_ANY && render != null) { render(this, new RenderFrameEventArgs(3, sample[IRLeftPanel])); } if (IRRightPanel != PXCMCapture.StreamType.STREAM_TYPE_ANY && render != null) { render(this, new RenderFrameEventArgs(4, sample[IRRightPanel])); } /* Optional: Set Mirror State */ mirror = Mirror ? PXCMCapture.Device.MirrorMode.MIRROR_MODE_HORIZONTAL : PXCMCapture.Device.MirrorMode.MIRROR_MODE_DISABLED; if (mirror != sm.captureManager.device.QueryMirrorMode()) { sm.captureManager.device.SetMirrorMode(mirror); } /* Optional: Show performance tick */ if (image != null) { timer.Tick(PXCMImage.PixelFormatToString(image.info.format) + " " + image.info.width + "x" + image.info.height); } sm.ReleaseFrame(); } } else { SetStatus("Init Failed"); sts = false; } sm.Dispose(); if (sts) { SetStatus("Stopped"); } } catch (Exception e) { SetStatus(e.GetType().ToString()); } }
private void ElaborateSample(PXCMCapture.Sample sample) { if (sample == null) return; WriteableBitmap imageRGB = null; if (sample.color != null) { imageRGB = sample.color.GetImage(); if (imageRGB != null) { imageRGB.Freeze(); Dispatcher.Invoke(() => { this.ImageRGB = imageRGB; }); } } }
private void ScanForProfiles(int deviceIndex) { PXCMSession.ImplDesc desc = new PXCMSession.ImplDesc(); desc.group = PXCMSession.ImplGroup.IMPL_GROUP_SENSOR; desc.subgroup = PXCMSession.ImplSubgroup.IMPL_SUBGROUP_VIDEO_CAPTURE; desc.iuid = devicesUIDs[deviceIndex]; int current_device_iuid = desc.iuid; desc.cuids[0] = PXCMCapture.CUID; profiles.Clear(); List <string> colorStrings = new List <string>(); List <string> depthStrings = new List <string>(); PXCMCapture capture; PXCMCapture.DeviceInfo dinfo2 = deviceInfo[deviceIndex]; if (session.CreateImpl <PXCMCapture>(desc, out capture) >= pxcmStatus.PXCM_STATUS_NO_ERROR) { PXCMCapture.Device device = capture.CreateDevice(dinfo2.didx); if (device != null) { PXCMCapture.Device.StreamProfileSet profile = new PXCMCapture.Device.StreamProfileSet(); for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s); if (((int)dinfo2.streams & (int)st) != 0) { int num = device.QueryStreamProfileSetNum(st); for (int p = 0; p < num; p++) { if (device.QueryStreamProfileSet(st, p, out profile) < pxcmStatus.PXCM_STATUS_NO_ERROR) { break; } PXCMCapture.Device.StreamProfile sprofile = profile[st]; string profileText = ProfileToString(sprofile); try { profiles.Add(profileText, sprofile); } catch { } switch (st) { case PXCMCapture.StreamType.STREAM_TYPE_COLOR: colorStrings.Add(profileText); break; case PXCMCapture.StreamType.STREAM_TYPE_DEPTH: depthStrings.Add(profileText); break; } } } } device.Dispose(); } capture.Dispose(); } colorProfiles = new ListParamDesc <string>(colorStrings) { Description = "Color Profiles", ReadableWhen = ParamDesc.ConnectionStates.Connected, }; depthProfiles = new ListParamDesc <string>(depthStrings) { Description = "Depth Profiles", ReadableWhen = ParamDesc.ConnectionStates.Connected, }; }
private pxcmStatus onModuleProcessedFrame(int mid, PXCMBase module, PXCMCapture.Sample sample) { if (mid == PXCMHandModule.CUID) { this._handData.Update(); } return pxcmStatus.PXCM_STATUS_NO_ERROR; }