How do I convert camera data to Image?



1 comment

  • DJI Developer Support
    I guess you are referring to YuvDataListener or CameraFrameListener. I would appreciate it if you could point out any errors that may have occurred. The push frequency of these listeners cannot be adjusted, as they receive video frames from the camera at the corresponding YUV data rate. While you suggested not providing sample code on how to convert YUV data to a PNG image, the sample code does offer a reference that can be directly used. If you are using CameraFrameListener to retrieve data, you can set the data format to RGBA_8888 when setting up the listener, then use bitmap.copyPixelsFromBuffer to convert it to a bitmap. Finally, you can use bitmap.compress to output it in the desired image format.
    Comment actions Permalink

Please sign in to leave a comment.