AtsushiSuzuki / unity-depthcapture-ios

Unity plugin to obtain depth map from iPhone camera.
ISC License
50 stars 5 forks source link

Non Linear Depth Issue #3

Open thechargedneutron opened 4 years ago

thechargedneutron commented 4 years ago

I used the plugin to obtain a depth map from iPhone X and XR. All works correct, but I guess the returned depth values are non-linear. I captured an image of an object oriented such that the depth changes gradually. I simply mapped depth in a range to RB from 0-255 and G 255 when out of range / undefined. The obtained image is as follows: image Now I plotted the R values after taking a suitable window around the region of interest and obtained this:

image

This is indicative of the fact that the returned depth values are non-linear.

Can you help me out with a solution to this or maybe the error in my formulation?

Thanks

AtsushiSuzuki commented 4 years ago

Very interesting. Correcting depth map using AVDepthData.cameraCalibrationData may fix this, but I'm not certain.

https://developer.apple.com/documentation/avfoundation/avdepthdata https://github.com/shu223/iOS-Depth-Sampler/issues/5

thechargedneutron commented 4 years ago

@AtsushiSuzuki Thank you for your reply. I tried following the second link which asks to uncomment certain parts of AVCameraCalibrationData.h but either it is not working, or I am making some mistake. Can you provide a possible working solution to this?

AtsushiSuzuki commented 4 years ago

Unfortunately for now I don't have iOS development environment (and phone), so I cannnot handle this issue right now, sorry.