Try MAXST AR Fusion Tracker Now ✨
List
TrackedImage.getData() to bitmap
Posted Date: 2021-11-26 4:19     Edited Date: 2021-11-29 1:36     Writer: ctt2009

Please provide your development details as below;

1. SDK Version:
2. Development Environment: (eg. Unity-Android, Unity-iOS, Native Android, Native iOS): Naive android
3. Tracker/Scanner:
4. License Type(Free / Pro-One Time Fee / Pro-Subscription / Enterprise):
5. Target Device(Optional):

We can assist better if you attach screenshots of issues.

Hi, 

I hope to get the frame's bitmap. I use this method: 

TrackingState state = TrackerManager.getInstance().updateTrackingState();
TrackingResult trackingResult = state.getTrackingResult();
TrackedImage image = state.getImage();
byte data[] = image.getData();
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);

Then I save the bitmap to local storage, however, the bitmap is only black.

Could you help to correct my code? I guess the data[] is a special format, please help.

 

Thanks.

BRs.

Emily

 

 

 

 

 

Posted Date: 2021-11-29 1:36     Edited Date: 2021-11-29 1:36     Writer: sjkim

Thank you for your interest in MAXST AR SDK.

 

To get the bitmap, please refer to bottom code

 

TrackingState state = TrackerManager.getInstance().updateTrackingState();
TrackingResult trackingResult = state.getTrackingResult();
byte[] data = state.getImage().getData();
int dataLength = data.length;
BitmapFactory.Options options = new BitmapFactory.Options();
options.inMutable = true;
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, options);

 

If you have related the MAXST SDK questions, feel free to ask.

 


 
Best regards,

Francisco

MAXST Support Team