dji-sdk / Mobile-SDK-Android-V5

MSDK V5 Sample
Other
247 stars 126 forks source link

`ICameraStreamManager.FrameFormat.NV21` Produces Incorrect Colors #334

Open jreedy-riis opened 1 month ago

jreedy-riis commented 1 month ago

While working with the MSDK 5.8.0, we have noticed an issue present in the frame formats for the cameraStreamManager.addFrameListener(). It seems that the FrameFormat.YUV420_888, FrameFormat.YUV444_888, FrameFormat.YUY2, and FrameFormat.NV21 produce a frame with incorrect colors. The only format that currently doesn't is FrameFormat.RGBA_8888. In my testing, this became present in the very first alpha version of 5.8.0 and is still present in 5.9.0.

I have attached sample images to show the issue. The first image is a screenshot from the putCameraStreamSurface, the second image is from the addFrameListener with the format of RGBA_8888 and the last image is of NV21. As you can see, the image from the controller and the RGBA_8888 look very similar, however, when you compare it to the image taken from NV21, the image has colors that appear much darker, almost as if a filter is being applied on top. In addition, during my testing I have noticed details in darker areas of the image have become lost when using NV21.

Because of this issue, I cannot use the NV21 frame format directly, I must first convert the RGBA_8888 byte array to an NV21 byte array in order to get the correct format.

In my further testing, it also looks like the deprececated .addYuvDataListener also experiences this same issue on 5.8.0, but not on 5.7.0.

Image Pulled from DJI RC Plus

5 9-app_screen-cropped

Frame with RGBA_8888

5 9-normal-cropped

Frame with NV21

5 9-nv21-cropped
dji-dev commented 1 month ago

Agent comment from yating.liao in Zendesk ticket #107571:

Thank you for providing the photos, but the color differences don't seem to be significant, and they won't affect the recognition of the image. What are you trying to achieve with NV21?

Thank you.

°°°