Skip to content

Commit

Permalink
android java example fix
Browse files Browse the repository at this point in the history
  • Loading branch information
matkatz committed Aug 26, 2019
1 parent be8cf91 commit 60b30fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import com.intel.realsense.librealsense.DepthFrame;
import com.intel.realsense.librealsense.DeviceListener;
import com.intel.realsense.librealsense.Extension;
import com.intel.realsense.librealsense.Frame;
import com.intel.realsense.librealsense.FrameSet;
import com.intel.realsense.librealsense.Pipeline;
import com.intel.realsense.librealsense.RsContext;
Expand Down Expand Up @@ -93,8 +95,9 @@ private void stream() throws Exception {
while (!mStreamingThread.isInterrupted())
{
try (FrameSet frames = pipe.waitForFrames()) {
try (final DepthFrame depth = frames.first(StreamType.DEPTH).as(DepthFrame.class))
try (Frame f = frames.first(StreamType.DEPTH))
{
DepthFrame depth = f.as(Extension.DEPTH_FRAME);
final float deptValue = depth.getDistance(depth.getWidth()/2, depth.getHeight()/2);
runOnUiThread(new Runnable() {
@Override
Expand Down
3 changes: 2 additions & 1 deletion wrappers/android/examples/java_example/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ Start streaming using a Pipeline, wait for new frames to arrive on each iteratio
> while (!mStreamingThread.isInterrupted())
> {
> try (FrameSet frames = pipe.waitForFrames()) {
> try (final DepthFrame depth = frames.first(StreamType.DEPTH).as(DepthFrame.class))
> try (Frame f = frames.first(StreamType.DEPTH))
> {
> DepthFrame depth = f.as(Extension.DEPTH_FRAME);
> final float deptValue = depth.getDistance(depth.getWidth()/2, depth.getHeight()/2);
> runOnUiThread(new Runnable() {
> @Override
Expand Down

0 comments on commit 60b30fe

Please sign in to comment.