我得到了 Orbbec 相机。
我使用 C#。
我有他们的 SDK 的 C# 包装器。
我有深度流,可以从该流中获取图像。但是,如何将像素值转换为距离(以毫米为单位)?
我环顾四周,即谷歌搜索,并给 Orbbec 人发了电子邮件。
到目前为止我的代码:
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);
??如何读取 mat 数据并将其转换为距离?}
谢谢