- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I've been looking trough a lot of topic on the Intel forum but I don't find any answer to my problem, I'm a beginner at devellopping.
I work on a WindowsForm in C# (I'm a beginner) I want to save a depth picture with a continuous grayscale (or at least a continous scale) like in the SDK, but I get a discontinuous color scale.
Here is my code:
PXCMSenseManager sm = session.CreateSenseManager();
sm.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_DEPTH, 0, 0);
sm.Init();
pxcmStatus status = sm.AcquireFrame(true);
PXCMCapture.Sample sample = sm.QuerySample();
PXCMImage dimage = sample.depth;
PXCMImage.ImageData data2;
dimage.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.PixelFormat.PIXEL_FORMAT_DEPTH_RAW, out data2);
Int16[] buffer = data2.ToShortArray(0, dimage.info.width * dimage.info.height);
Bitmap bm2 = new Bitmap(dimage.info.width, dimage.info.height, PixelFormat.Format16bppRgb555);
BitmapData bmapdata = bm2.LockBits(new Rectangle(0, 0, dimage.info.width, dimage.info.height), ImageLockMode.WriteOnly, bm2.PixelFormat);
IntPtr ptr = bmapdata.Scan0;
Marshal.Copy(buffer, 0, ptr, dimage.info.width * dimage.info.height);
bm2.UnlockBits(bmapdata);
bm2.Save(@"" + path + "\\" + date + "_depth_" + cpt + ".png", ImageFormat.Png);
dimage.ReleaseAccess(data2);
The image I get: http://img11.hostingpics.net/pics/33861503032016depth2.png
Thanks :)
Link Copied
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page