Ok I figured it out. This depth value is just "z" component of x,y,z coordinates.
rest of code:
var intrinsics = cameraIntrinsics
intrinsics[0][0] /= cameraToDepthRatio
intrinsics[1][1] /= cameraToDepthRatio
intrinsics[2][0] /= cameraToDepthRatio
intrinsics[2][1] /= cameraToDepthRatio
let depthMapPixelPoint = pointOnBuffer
let xrw = ((Float(depthMapPixelPoint.x) - intrinsics[2][0]) * depth / intrinsics[0][0])
let yrw = (Float(depthMapPixelPoint.y) - intrinsics[2][1]) * depth / intrinsics[1][1]
// Y is UP in camera space, vs it being DOWN in image space.
let localPoint = simd_float3(xrw, -yrw, -depth)
let worldPoint = viewMatrix.inverse * simd_float4(localPoint, 1)
let result = simd_float3(worldPoint.x, worldPoint.y, worldPoint.z)
let vector = result - cameraPosition
let distance = simd_length(vector)
Post
Replies
Boosts
Views
Activity
During "Metal lab" with Apple, Metal engineer told me that it is ok
I was experimenting for few days and checking other people solutions but problem with incorrect depth values when iPad is rotated seems to be in every implementation.
I collected data representing depth error percentage comparing real depth with depth from depthMap for iPad camera angles from 0 to 30 degrees and there is clear correlation:
For 30 degrees error is about 13%. (with confidence == 2)
What am I missing here?
Any help would be appreciated, thanks:)
Thank you! :)
Thank you :) It works. I didn't know SecPolicyCreateBasicX509 is like "just check the minimum"
It is coming from IoT device
wrong hostname because we are connecting via IP address, this is not really a problem because we have SAN name
long expiration date is our real problem here, we do not want to generate new certificates every 825 days