Insta360Develop / CameraSDK-Android

Android SDK to control Insta360 cameras
80 stars 9 forks source link

Get equirectangular Bitmap of imagePreview (like OSC) #27

Open mordekai91 opened 2 years ago

mordekai91 commented 2 years ago

Hi! is there an option to get the image preview frame from the camera? I need the bitmap of every frame

thanks you! :)

Edit: after change the sdk version to 1.3.23 I get this interface (on 1.3.3 doesnt exist)

   @Override
    public void onVideoData(VideoData videoData) {
        Bitmap mBitmap = BitmapFactory.decodeByteArray(videoData.data, videoData.offset, videoData.size);
        if (mBitmap != null) {
            //use the bitmap
        }
    }

But BitmapFactory always return null, any idea? videoData.data is not null

Tkorn commented 1 year ago

Refer to the following code in java/com/arashivision/sdk/demo/activity/Preview3Activity.java image image

PauGuillamon commented 1 year ago

@Tkorn The problem I see with the approach shown in the sample app is that it first goes through CapturePlayerView and then a separate SurfaceView. Additionally the sample preview3 is really slow due to ImageRenader (I believe) even after removing the part of saving the bitmap (tested on a Samsung Galaxy S21).

It should be possible to implement a custom preview, either through a byte array or even through an OpenGL texture. Is there currently a way to render the preview directly on an independent OpenGL rendering pipeline?

That would be ideal, I am trying to apply some custom video effects and compute some ML algorithms on the video preview but I can't find a way to do it. Pan & zoom controls would be implemented by the application and passed to the SDK.

Alternatively, I am also fine receiving the flat plane and handling myself the 360 preview together with direction & zoom.

I used the latest SDK version available as of today, v1.5.6.