does not support "librealsense::depth_frame" interface! state
Hi: Here is my code in Android with Kotlin:
val frameSet = mPipeline!!.waitForFrames().releaseWith(frameReleaser) val processed: FrameSet if (shouldFillHoles) processed = frameSet .applyFilter(align).releaseWith(frameReleaser) .applyFilter(holeFillingFilter).releaseWith(frameReleaser) .applyFilter(colorizer).releaseWith(frameReleaser) else processed = frameSet .applyFilter(align).releaseWith(frameReleaser) .applyFilter(colorizer).releaseWith(frameReleaser)
// Acquire depth map image
val depthFrame = processed.first(StreamType.DEPTH).releaseWith(frameReleaser)
.as<VideoFrame?>(
Extension.DEPTH_FRAME
)
mdepthFrame = depthFrame as DepthFrame
val distance = mdepthFrame!!.getDistance(yi,xi)
but,I get the Error like this: [rs2_depth_frame_get_distance( frame_ref:0xb40000710282e640, x:291, y:283 ) UNKNOWN] Object does not support "librealsense::depth_frame" interface!
what's the problem? what should I do?
I cant get the distance!
Hi @Dclpwos My knowledge of Android programming is admittedly limited. The link below has an official example of Android Java code for getting the depth value (distance) though if you have not seen it already.
https://github.com/IntelRealSense/librealsense/tree/master/wrappers/android/examples/java_example#streaming-function
Hi @Dclpwos My knowledge of Android programming is admittedly limited. The link below has an official example of Android Java code for getting the depth value (distance) though if you have not seen it already.
https://github.com/IntelRealSense/librealsense/tree/master/wrappers/android/examples/java_example#streaming-function
Hi,I know why that happened now,It's because the "as",It should be val depthFrame = processed.first(StreamType.DEPTH).releaseWith(frameReleaser) .as<DepthFrame?>( Extension.DEPTH_FRAME ) and "mdepthFrame = depthFrame as DepthFrame" is not necessary。
But I came to another problem!, How can I get the Intrinsic or Extrinsic' attribute,like focal distance,rotation matirx。In java or kotlin,It‘s a private var。how I can get it。
Five years ago at the time of writing this, a RealSense user submitted a Pull Request (PR) modification to the Android wrapper at https://github.com/IntelRealSense/librealsense/pull/7342/commits/1f15fe3e52ef856a0b941ab2a800201fa6d3e11f to enable private intrinsic variables to be accessed but then they withdrew it before final approval so it was apparently never added to the Android wrapper.
It might be possible to recreate that access in the Android wrapper yourself though by recreating the green-highlighted changes at the above link in the source code of the intrinsic.java file of the wrapper.
Alternatively, a RealSense user at https://github.com/IntelRealSense/librealsense/issues/6522#issuecomment-639152764 took the approach of storing intrinsics and extrinsics using C++ Native code in their Android application.
Hi @Dclpwos Do you require further assistance with this case, please? Thanks!