Intel® oneAPI Base Toolkit
Support for the core tools and libraries within the base toolkit that are used to build and deploy high-performance data-centric applications.
419 Discussions

Android integrated realsense2,How to convert Frame to Mat(OpenCV4.5.2)

Luyang
Beginner
732 Views

Hi,I want to integrate realsense in Android, but I have encountered some problems. How to convert Frame to Mat(OpenCV4.5.2)?My hardware is RealSense455. Thanks everybody!

 

    private FrameCallback mFrameHandler = new FrameCallback() {
@Override
public void onFrame(final Frame f) {
try {
if (f != null) {
// Log.d(TAG, "frame received: " + f.getNumber() + ", " + f.getDataSize() + ", " + f.getProfile().getType().name());
// Log.d(TAG, "onFrame: " + f.getProfile().getType());
if (f.is(Extension.MOTION_FRAME)) {
MotionFrame fm = f.as(Extension.MOTION_FRAME);
mGLSurfaceView.upload(fm);
} else {
FrameSet fs = f.as(Extension.FRAMESET);
if (fs != null) {
try (FrameSet processed = fs.applyFilter(mColorizer)) {
mGLSurfaceView.upload(processed);
}

fs = align.process(fs);
Frame frame = getColorFrame(fs);
Mat mat = mDetect.frameToMat(frame);

Bitmap bitmap = Bitmap.createBitmap(480, 640, Bitmap.Config.ARGB_8888);
Utils.matToBitmap(mat, bitmap);
setImageView(bitmap);
}
}
}
} catch (Exception e) {
Log.d(TAG, "onFrame: " + e);
}
}
};

 

0 Kudos
1 Reply
ArpitaP_Intel
Moderator
710 Views

Hi,


This forum primarily support queries related to issues with Intel oneAPI Base Toolkit. RealSense queries are not supported here. Please submit RealSense queries here:

https://support.intelrealsense.com/hc/en-us/requests/new

We wouldn't be monitoring this thread further. Please feel free to raise a new thread in case of issues with Intel oneAPI Base Toolkit.


Thanks!


0 Kudos
Reply