Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I just get the data from realsense device on android : depth sensor, rgb camera . I have requirement of those resources in my background service. I dont want any container for rendering image on UI. Just I want data I will decrypt it on other way if required. Is there any API which solves this #8551

Closed
ghost opened this issue Mar 11, 2021 · 48 comments
Labels

Comments

@ghost
Copy link

ghost commented Mar 11, 2021

  • Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):

  • All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)


Required Info
Camera Model { R200 / F200 / SR300 / ZR300 / D400 }
Firmware Version (Open RealSense Viewer --> Click info)
Operating System & Version {Win (8.1/10) / Linux (Ubuntu 14/16/17) / MacOS
Kernel Version (Linux Only) (e.g. 4.14.13)
Platform PC/Raspberry Pi/ NVIDIA Jetson / etc..
SDK Version { legacy / 2.. }
Language {C/C#/labview/nodejs/opencv/pcl/python/unity }
Segment {Robot/Smartphone/VR/AR/others }

Issue Description

<Describe your issue / question / feature request / etc..>

@ghost ghost changed the title How can I just get the data from realsense device on android : depth sensor, rgb camera . How can I just get the data from realsense device on android : depth sensor, rgb camera . I have requirement of those resources in my background service. I dont want any container for rendering image on UI. Just I want data I will decrypt it on other way if required. Is there any API which solves this Mar 11, 2021
@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Mar 11, 2021

Hi @bjain409 The librealsense Android wrapper's example program capture may meet your needs with some modification to disable visual rendering, as it makes use of depth and RGB streams.

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/android/examples/capture/

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/android/examples/capture/src/main/java/com/intel/realsense/capture/MainActivity.java#L163

My understanding is that the visual rendering is handled by the OpenGL GLRsSurfaceView elements of the script. So you could try removing or commenting-out these parts out or removing them until the program meets your needs of displayless streaming.

The case in the link below about the Android capture example includes an image of the unmodified program running on a phone, to provide you with an illustration of the captured data:

#4091 (comment)

image

@ghost
Copy link
Author

ghost commented Mar 12, 2021

Hi @bjain409 The librealsense Android wrapper's example program capture may meet your needs with some modification to disable visual rendering, as it makes use of depth and RGB streams.

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/android/examples/capture/

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/android/examples/capture/src/main/java/com/intel/realsense/capture/MainActivity.java#L163

My understanding is that the visual rendering is handled by the OpenGL GLRsSurfaceView elements of the script. So you could try removing or commenting-out these parts out or removing them until the program meets your needs of displayless streaming.

The case in the link below about the Android capture example includes an image of the unmodified program running on a phone, to provide you with an illustration of the captured data:

#4091 (comment)

image
Hi,
@MartyG-RealSense
Thanks for responding
I am not completely following the process.
Let me tell you the actual requirement.
I am building an android apk with realsense 4351i.
wherein I will create an trigger from android end for capture.
The apk will be a background process running continously .
After capture is triggered I need object of rgb camera and depth camera. is there any API defined . which returns be just the object of bitmaps.
If not can you please create a service which returns.
.

Thanks..

@ghost
Copy link
Author

ghost commented Mar 12, 2021

Hi @bjain409 The librealsense Android wrapper's example program capture may meet your needs with some modification to disable visual rendering, as it makes use of depth and RGB streams.
https://github.com/IntelRealSense/librealsense/blob/master/wrappers/android/examples/capture/
https://github.com/IntelRealSense/librealsense/blob/master/wrappers/android/examples/capture/src/main/java/com/intel/realsense/capture/MainActivity.java#L163
My understanding is that the visual rendering is handled by the OpenGL GLRsSurfaceView elements of the script. So you could try removing or commenting-out these parts out or removing them until the program meets your needs of displayless streaming.
The case in the link below about the Android capture example includes an image of the unmodified program running on a phone, to provide you with an illustration of the captured data:
#4091 (comment)
image
Hi,
@MartyG-RealSense
Thanks for responding
I am not completely following the process.
Let me tell you the actual requirement.
I am building an android apk with realsense 4351i.
wherein I will create an trigger from android end for capture.
The apk will be a background process running continously .
After capture is triggered I need object of rgb camera and depth camera. is there any API defined . which returns be just the object of bitmaps.
If not can you please create a service which returns.
.

Thanks..
@

@ghost ghost closed this as completed Mar 12, 2021
@ghost
Copy link
Author

ghost commented Mar 12, 2021

Hi @bjain409 The librealsense Android wrapper's example program capture may meet your needs with some modification to disable visual rendering, as it makes use of depth and RGB streams.
https://github.com/IntelRealSense/librealsense/blob/master/wrappers/android/examples/capture/
https://github.com/IntelRealSense/librealsense/blob/master/wrappers/android/examples/capture/src/main/java/com/intel/realsense/capture/MainActivity.java#L163
My understanding is that the visual rendering is handled by the OpenGL GLRsSurfaceView elements of the script. So you could try removing or commenting-out these parts out or removing them until the program meets your needs of displayless streaming.
The case in the link below about the Android capture example includes an image of the unmodified program running on a phone, to provide you with an illustration of the captured data:
#4091 (comment)
image
Hi,
@MartyG-RealSense
Thanks for responding
I am not completely following the process.
Let me tell you the actual requirement.
I am building an android apk with realsense 4351i.
wherein I will create an trigger from android end for capture.
The apk will be a background process running continously .
After capture is triggered I need object of rgb camera and depth camera. is there any API defined . which returns be just the object of bitmaps.
If not can you please create a service which returns.
.

Thanks..
@
@MartyG-RealSense
Can you please create a service which will return the rgb and dept camera image
which accepts an flag 2d or 3d(optional if not feasible for android framework) and returns result to calling thread?

@ghost ghost reopened this Mar 12, 2021
@MartyG-RealSense
Copy link
Collaborator

My understanding from your description earlier is that the Android app will be streaming depth and color continuously. You wish to be able to trigger a capture, which will save depth and color images. Is that correct, please?

If it is, the links below provide examples of scripting references for converting an Android frame to a bitmap and then saving it as an image. These could possibly be used to program the desired feature in your Android application yourself.

#5446

#4455

#6089

#8316

@ghost
Copy link
Author

ghost commented Mar 19, 2021

My understanding from your description earlier is that the Android app will be streaming depth and color continuously. You wish to be able to trigger a capture, which will save depth and color images. Is that correct, please?

If it is, the links below provide examples of scripting references for converting an Android frame to a bitmap and then saving it as an image. These could possibly be used to program the desired feature in your Android application yourself.

#5446

#4455

#6089

#8316

@MartyG-RealSense
Copy link
Collaborator

Hi @bjain409 Your new comment above just quotes my previous comment from 7 days ago. Do you require further assistance please? Thanks!

@ghost
Copy link
Author

ghost commented Mar 19, 2021

Hi @bjain409 Your new comment above just quotes my previous comment from 7 days ago. Do you require further assistance please? Thanks!

@MartyG-RealSense I am not getting proper support for my requirement.
@dorodnic Can you please help me with my requirements?

Thanks.

@MartyG-RealSense
Copy link
Collaborator

Hi again @bjain409 Is there anything more that I can do for you, bearing in mind that Intel cannot quickly create an Android feature to meet your needs.

@ghost
Copy link
Author

ghost commented Mar 25, 2021

Hi again @bjain409 Is there anything more that I can do for you, bearing in mind that Intel cannot quickly create an Android feature to meet your needs.

@MartyG-RealSense
By when I can expect this feature?

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Mar 25, 2021

A feature request can be made but the process can take a significant period of time to complete and does not necessarily result in the feature request being approved for creation. This is why the preferable option is to develop your own solution based upon advice provided on this forum.

@ghost
Copy link
Author

ghost commented Mar 26, 2021

A feature request can be made but the process can take a significant period of time to complete and does not necessarily result in the feature request being approved for creation. This is why the preferable option is to develop your own solution based upon advice provided on this forum.

@MartyG-RealSense
None of the solutions provided is useful.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Mar 26, 2021

@bjain409 In your opening message of this discussion, you stated the requirement for depth and RGB data on Android but with no UI rendering. As the Android Capture example provides simultaneous depth and RGB streaming, I suggested using that example's code but disabling the visual rendering elements so that your application could access the live stream data without needing to render it on-screen.

After that suggestion, you added the following requirement:

"I am building an Android apk with RealSense 4351i, wherein I will create an trigger from Android end for capture. The apk will be a background process running continuously. After capture is triggered I need object of RGB camera and depth camera. Is there any API defined which returns just the object of bitmaps".

The Capture code with rendering disabled would seem to meet your needs for a background process running continuously. Am I correct in thinking that you also require a trigger mechanism in the Android app that will export a depth image and RGB image of the frame that was captured when the trigger was activated, please? And if that is correct, would the trigger be automatic (for example, a capture every 5 minutes) or would it be manually activated by a button press on the app?

In link #8551 (comment) I pointed to examples of code for converting an Android frame to a bitmap and capturing it as a image.

If that code is suitable for creating an image capture mechanism, then the only part of the project that would seem to be missing is the trigger mechanism.

@MartyG-RealSense
Copy link
Collaborator

Hi @bjain409 Could you provide feedback about the advice provided in the comment above please? Thanks!

@ghost
Copy link
Author

ghost commented Apr 1, 2021

Hi @bjain409 Could you provide feedback about the advice provided in the comment above please? Thanks!

@MartyG-RealSense
I am not at all satisfied with the advice.
I thought purchasing intel-realsense device would be greatly helpful and would have support for it, But it's not true!
I might get the depth sensor integrated with RGB of different OEMs.
At least that would not cost me as high as intel costs me.

@ghost
Copy link
Author

ghost commented Apr 1, 2021

@MartyG-RealSense
Copy link
Collaborator

It looks as though in this example, the dependency code mentioned in the above link is located in the build.gradle file in the folder examples/java_example/app/

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/android/examples/java_example/app/build.gradle#L30

image

@ghost
Copy link
Author

ghost commented Apr 2, 2021

It looks as though in this example, the dependency code mentioned in the above link is located in the build.gradle file in the folder examples/java_example/app/

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/android/examples/java_example/app/build.gradle#L30

image

Hello @MartyG-RealSense
I have followed the same instruction
But while attaching a device get the pop-up only once
Not like in the case of the capture or recording module wherein I get the pop-up twice.
So the app crashes and I don't get frames

@ghost
Copy link
Author

ghost commented Apr 2, 2021

It looks as though in this example, the dependency code mentioned in the above link is located in the build.gradle file in the folder examples/java_example/app/
https://github.com/IntelRealSense/librealsense/blob/master/wrappers/android/examples/java_example/app/build.gradle#L30
image

Hello @MartyG-RealSense
I have followed the same instruction
But while attaching a device get the pop-up only once
Not like in the case of the capture or recording module wherein I get the pop-up twice.
So the app crashes and I don't get frames

@MartyG-RealSense
https://github.com/bjain409/libRealsenseViaDependency.git
This is what I did. Its not working

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Apr 2, 2021

It looks as though the Android example has been cloned to your GitHub so it is mostly the same except for the MainActivity.java file.

Did the program run okay on your GitHub in its original form before you began adapting MainActivity.java?

@ghost
Copy link
Author

ghost commented Apr 2, 2021

It looks as though the Android example has been cloned to your GitHub so it is mostly the same except for the MainActivity.java file.

Did the program run okay on your GitHub in its original form before you began adapting MainActivity.java?
@MartyG-RealSense
It's not working. I copied the same content from the capture module and in the java example as you can see.
Did you try running?

@ghost
Copy link
Author

ghost commented Apr 2, 2021

It looks as though the Android example has been cloned to your GitHub so it is mostly the same except for the MainActivity.java file.
Did the program run okay on your GitHub in its original form before you began adapting MainActivity.java?
@MartyG-RealSense
It's not working. I copied the same content from the capture module and in the java example as you can see.
Did you try running?
@MartyG-RealSense
I had invested more than 10 days in using dependencies
But it was not helpful. I was working with the whole project I was using the capture module. I thought something is wrong at my end. But as you suggested I followed the same. Its still not helpful
Can you plz check it

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Apr 2, 2021

My Android programming knowledge is limited, so I will seek advice about your case.

@ghost
Copy link
Author

ghost commented Apr 2, 2021

My Android programming knowledge is limited, so I will seek advice from Intel about your case.
But were you able to run the app?

My Android programming knowledge is limited, so I will seek advice from Intel about your case.

@MartyG-RealSense
Were you able to run the app? via dependency?
Pardon me as well even I am not a well-experienced android developer.
Can you please ask to resolve the issue asap
Thanks.

@MartyG-RealSense
Copy link
Collaborator

I am not able to test Android programs myself unfortunately. I have sent a message to Intel for programming advice about your case.

@ghost
Copy link
Author

ghost commented Apr 3, 2021

I am not able to test Android programs myself unfortunately. I have sent a message to Intel for programming advice about your case.

@MartyG-RealSense
Please resolve this asap.
This is blocking my further development.

@MartyG-RealSense
Copy link
Collaborator

I have talked about your case with Intel. Another RealSense team member will join this discussion.

@ghost
Copy link
Author

ghost commented Apr 3, 2021

I have talked about your case with Intel. Another RealSense team member will join this discussion.

@MartyG-RealSense
Just a question I want to ask.
How can something get merged into master without being verified

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Apr 3, 2021

If you are referring to Pull Requests, then you could edit a change into the source code version of librealsense and build it. Because it is a private custom version of librealsense though, only your librealsense build would have it and the change would not be a part of the public master branch of librealsense.

Some RealSense users make a custom version by cloning a fork of librealsense from the librealsense GitHub to their own GitHub and then using that version.

@ghost
Copy link
Author

ghost commented Apr 3, 2021

If you are referring to Pull Requests, then you could edit a change into the source code version of librealsense and build it. Because it is a private custom version of librealsense though, only your librealsense build would have it and the change would not be a part of the public master branch of librealsense.

Some RealSense users make a custom version by cloning a fork of librealsense from the librealsense GitHub to their own GitHub and then using that version.

@MartyG-RealSense
Ok, nevermind please fix the issue asap.

@MartyG-RealSense
Copy link
Collaborator

The other RealSense team member will work with you on your case when they join it. Please work with them. Thanks very much.

@ghost
Copy link
Author

ghost commented Apr 3, 2021

The other RealSense team member will work with you on your case when they join it. Please work with them. Thanks very much.

@MartyG-RealSense
Can I expect their correspondence by eod?

@MartyG-RealSense
Copy link
Collaborator

As it is Saturday at the time of writing this, it may be after the weekend now.

@ghost
Copy link
Author

ghost commented Apr 3, 2021

As it is Saturday at the time of writing this, it may be after the weekend now.

@MartyG-RealSense
Ok no worries
Just ask them to correspond asap.
Thanks for being kind and being helpful🙏

@ghost
Copy link
Author

ghost commented Apr 6, 2021

As it is Saturday at the time of writing this, it may be after the weekend now.

@MartyG-RealSense
Ok no worries
Just ask them to correspond asap.
Thanks for being kind and being helpful

@MartyG-RealSense
Any update?

@RealSenseSupport
Copy link
Collaborator

RealSenseSupport commented Apr 7, 2021

@bjain409 Sorry I didn't follow your requirement. If for the requirement in the ticket title, I think MartyG has replied the good solution. #8551 (comment) Or could you please clarify more about your requirements? Or anything missing in MartyG's reply? Thanks!

And for your issue mentioned later, I saw you created another ticket #8728 We'll look into the later issue in that ticket.

@ghost
Copy link
Author

ghost commented Apr 7, 2021

@bjain409 Sorry I didn't follow your requirement. If for the requirement in the ticket title, I think MartyG has replied the good solution. #8551 (comment) Or could you please clarify more about your requirements? Or anything missing in MartyG's reply? Thanks!

And for your issue mentioned later, I saw you created another ticket #8728 We'll look into the later issue in that ticket.

@RealSenseSupport
Thanks for responding.
The current requirement is #8728 Sorry I quoted that issue here.
Can you please fix issue #8728 asap.
Currently, I am directly working on the capture module And I can't delete any of the other folders from root As it breaks the app.
By when it can be done?

@RealSenseSupport
Copy link
Collaborator

@bjain409 So can I understand this issue #8551 resolved now?

For #8728, we need more information from you to debug. Please move to that issue for more details. Thanks!

@ghost
Copy link
Author

ghost commented Apr 7, 2021

@bjain409 So can I understand this issue #8551 resolved now?

For #8728, we need more information from you to debug. Please move to that issue for more details. Thanks!

#8551 is still not done.
What I need is not provided.

@RealSenseSupport
Copy link
Collaborator

@bjain409 Okay. Please clarify you detailed requirement in this ticket #8551.

@ghost
Copy link
Author

ghost commented Apr 7, 2021

@bjain409 Okay. Please clarify you detailed requirement in this ticket #8551.

@RealSenseSupport
I am building an android app that will be used for object detection.
It will background app. It won't have any UI components.
There will be a job that will trigger a capture event. In capture, it will store RGB image and depth sensor data.
For instance, take an example there will be a job which will run every 30mins.
Now every 30min images should be captured from both RGB and depth sensors simultaneously.
So I need a method that will return me RGB data and I need a matrix of depth data.
In the case of the depth sensor, I need the depth of individual pixel/point from the depth sensor.
I should get all the depth data from the individual point. It's required for 3D imaging to verify whether the object is real or just the 2d image/photo.
For instance, Consider I have capture triggered and now I want to recognize humans.
So by default nose tip will have the shortest distance from the sensor and the eyes will have more distance.
This will guarantee no one is spoofing. This is just the use case.

@ghost
Copy link
Author

ghost commented Apr 9, 2021

@bjain409 Okay. Please clarify you detailed requirement in this ticket #8551.

@RealSenseSupport
I am building an android app that will be used for object detection.
It will background app. It won't have any UI components.
There will be a job that will trigger a capture event. In capture, it will store RGB image and depth sensor data.
For instance, take an example there will be a job which will run every 30mins.
Now every 30min images should be captured from both RGB and depth sensors simultaneously.
So I need a method that will return me RGB data and I need a matrix of depth data.
In the case of the depth sensor, I need the depth of individual pixel/point from the depth sensor.
I should get all the depth data from the individual point. It's required for 3D imaging to verify whether the object is real or just the 2d image/photo.
For instance, Consider I have capture triggered and now I want to recognize humans.
So by default nose tip will have the shortest distance from the sensor and the eyes will have more distance.
This will guarantee no one is spoofing. This is just the use case.

@RealSenseSupport
Any update?

@RealSenseSupport
Copy link
Collaborator

@bjain409 I think MartyG has provided some reference to you in this ticket. Could you please check if these examples help you ? #8551 (comment)

@ghost
Copy link
Author

ghost commented Apr 15, 2021

@MartyG-RealSense
@RealSenseSupport
After getting the depth frame and video frame.
We have a method frame.getHeight, getWidth
are these values constants?
Does it change in any case at runtime?

@MartyG-RealSense
Copy link
Collaborator

Hi @bjain409 Your case is being handled by @RealSenseSupport now. Thank you.

@RealSenseSupport
Copy link
Collaborator

@bjain409 The value got from frame.getHeight, getWidth are constant which are the resolution you configure or default value if not configured. They will not change during streaming.

@RealSenseSupport
Copy link
Collaborator

@bjain409 Any other questions for this ticket? Thanks for your update!

@RealSenseSupport
Copy link
Collaborator

@bjain409 Anything else we can help on this ticket? Looking forward to your update. Please note that this ticket will be closed if we don't hear from you for another 7 days. Thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants