DJI-Mobile-SDK-Tutorials / Android-FPVDemo

This demo shows how to create a simple FPV view and how to take photo and record video using DJI Mobile SDK.
MIT License
62 stars 81 forks source link

Show thermal image instead of rgb image in Mavic Enterprise 2 #44

Closed mgrova closed 4 years ago

mgrova commented 4 years ago

Hi, i'm deploying an app to view and broadcast the thermal image of this aircraft. I seen the example of XT2 Camera in Android but, the operation of the Mavic 2 Enterprise camera and the way to work with it is similar?

How I can change these images and access to thermal image's callback to send and show it?

Best regards !

dji-dev commented 4 years ago

Agent comment from William Wong in Zendesk ticket #34039:

Dear Client Thank you for contacting DJI.

Hi, Could you confirm that your model is Mavic 2 Enterprise or Mavic 2 Enterprise Dual? Only Mavic 2 Enterprise Dual has thermal camera. To access the thermal camera, you can call getCameras function.

Hopefully our solution can help you. Kindly Regards, DJI Developer Support

mgrova commented 4 years ago

First of all, thank you very much for your quick response.

I have the Mavic 2 Enterprise Dual. I try to change between thermal or visual cameras basing on this stack overflow response;

https://stackoverflow.com/questions/56243851/setting-camera-mode-on-mavic-2-enterprise-dual-visual-thermal-and-msx-switch

But instead of use the "fetchCamera()" function i'm using the "getCameraInstance()" of your example. When I change to thermal mode, using the method setDisplayMode with parameter THERMAL_ONLY, the DJIerror tolds me "not supported":

  Camera camera = FPVDemoApplication.getCameraInstance();
  camera.setDisplayMode(SettingsDefinitions.DisplayMode.THERMAL_ONLY, new CommonCallbacks.CompletionCallback() {
                        @Override
                        public void onResult(DJIError error) {

                            if (error == null) {
                                showToast("Switch to thermal Succeeded");
                            } else {
                                showToast(error.getDescription());
                            }
                        }
                    });

The goal is to be able to switch between the cameras and access each callback.

Thank you very much for your time !! Best regards.

mgrova commented 4 years ago

Hi ! I have already managed to successfully change cameras by getting the camera with index 1, that is the thermal :

 BaseProduct base = FPVDemoApplication.getProductInstance();
 Camera camera = base.getCameras().get(1);

And using the above method switch between msx, visual or thermal.

Best regards!

dji-dev commented 4 years ago

Agent comment from William Wong in Zendesk ticket #34039:

Dear Client Thank you for contacting DJI.

Yes, you are correct. You get un support initially because you use getCamera function. That will give you the optical camera which does not support thermal functions. For Enterprise Dual, there are 2 cameras. So you have to use getCameras function to get the postion 1 camera which is the thermal camera and everything start working. Good luck for your further development and feel free to come to us if you have any queries.

Hopefully our solution can help you. Kindly Regards, DJI Developer Support