shader - iOS14 ARDepthData 的分辨率是多少?
问题描述
我正在尝试可视化由ARSession
和捕获的深度数据ARCamera
。我看到深度很好,除了平面物体(如显示器)的边缘,我希望在渲染平面和背景之间有更清晰的过渡。
我观察到的是物体边缘的“磨损”,深度值发生了显着变化。(创建自由浮动线,如下图所示)。我想删除自由浮动线。
这让我问:
ARDepthData 的“真实”分辨率是多少(值的哪一部分可以安全地作为噪声丢弃)?
使用 ARDepthData 时如何避免舍入错误?
open class ARDepthData : NSObject {
/* A pixel buffer that contains per-pixel depth data (in meters). */
unowned(unsafe) open var depthMap: CVPixelBuffer { get }
}
这是我尝试剪辑值的方式,但这会扭曲图像其余部分的分辨率。
const float2 samplePoint = float2(x, y); //0.0 - 1.0 range
const float2 clippingMultiplier = float2(64, 64);
const float2 clippedTextureCoordinate = (floor(texCoord * clippingMultiplier)) / clippingMultiplier; //attempt to clip fractional components
// What are the appropriate sampling filter parameters to reduce the error like in the screenshot?
constexpr sampler depthSampler(mip_filter::nearest, mag_filter::nearest, min_filter::nearest);
const auto depth = depthMap.sample(depthSampler, clippedTextureCoordinate).r;
//depth is used to calculate position
- 预期:一个尖锐的矩形
- 观察到:多股漂浮在空气中,深度值发生变化。
这是我从深度值中删除小数部分的尝试:
解决方案
对于前置真深度相机,AVDepthData 的最大深度分辨率为w640 h480
.
ARDepthData 似乎具有类似的低分辨率:
depth: w256 h192
confidence: w256 h192
推荐阅读
- javascript - Ajax 发布 FormData 和表单
- android - 如何从 RecyclerView 清理数据侦听器/订阅?
- mongodb - 在 kubernetes 中部署 MongoDB 不会创建 pod/services
- ios - Swapping rootViewController on UIWindow does not deallocate view controller
- bash - 如何在 rsync 命令上获得空运行状态
- here-api - REST vs Android API
- java - Eclipse Maven 项目和 GIT
- angular - 路由和 URL 处理 Angular
- python - How to prevent class field(list) change in Python?
- bash - How to make a bash script that will use cdhit on each file in the directory separately?