I got the Orbbec camera.
I use C#.
I have the C# wrapper for their SDK.
I have the depth stream and can get images from that stream. But, how do I convert the pixel value to distance (in mms)?
I have looked around ie Googling and I have emailed the Orbbec people.
So far my code:
private void HandleDepthFrame(
Astra.ReaderFrame frame )
{
var depthFrame = frame.GetFrame<Astra.DepthFrame>();
if ( depthBuffer.Update( depthFrame ) )
{
BitmapSource image = depthBuffer.ImageSource;
dispatcher.BeginInvoke(DispatcherPriority.DataBind, new Action(() => getBitmap(image)));
if ( frameRateCalculator.RegisterFrame() )
RaisePropertyChanged( nameof(FramesPerSecond) );
}
}
private void getBitmap(BitmapSource source)
{
Bitmap bmp = new Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
BitmapData data = bmp.LockBits(new System.Drawing.Rectangle(System.Drawing.Point.Empty, bmp.Size), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
bmp.UnlockBits(data);
Image<Gray, int16> imageCV = new Image<Gray, int16>(bmp);
??how to read and trsanslate the mat data to distance? }
Thanks
I use the C++ setup for astra and I was able to achieve this by using some code in the demos they provide in the Guide. This code here:
So in this demo you can actually see the values in depth being showned and using this sample code its possible to manipulate them to our favor. Hope this helps.