HFOV and VFOV probably not correctly reported in photo mode

I’m streaming video from the drone using the YUV callback in my python app. Up to now I was focused to use an OpenCV calibration file, derived from the drone’s camera for photo and video resolution. Luckily I found this link Getting Front Camera Pose & Intrinsic Parameters, which suggests, that it could be possible to derive camera intrinsics from the vmeta frame delivered with each frame. I have to say, that works great, but — just almost :slight_smile:

OK, let’s suppose, I’m using the sample code here for streaming: https://github.com/Parrot-Developers/olympe/blob/master/src/olympe/doc/examples/streaming.py

I have changed the yuv_frame_processing like so, that I write the results obtained from vmeta and info as well as the image itself to disk (this is all more or less your code or code which can be found, so I don’t reveal secrets here):

cv2_cvt_color_flag = {
     olympe.VDEF_I420: cv2.COLOR_YUV2BGR_I420,
     olympe.VDEF_NV12: cv2.COLOR_YUV2BGR_NV12,

vmeta = yuv_frame.vmeta()[1]
hfov = vmeta['camera']['hfov']
vfov = vmeta['camera']['vfov']
info = yuv_frame.info()
height, width = (  # noqa
cv2.imwrite(f"test_{width}_{height}_{hfov}_{vfov}.jpg", cv2Frame)

So, what I was doing with this is to start in video mode with a real Anafi 4k at zoom 1. As expected I got a file like this:


Definitely 1280 x 720.

Then I changed the zoom from 1 to 3 and the number of images increased on disk, until it finally just left one (terrible) image like this:


HFOV and VFOV have changed of course. Literally I can follow the down steps by observing the filenames going down the ladder (upwards sorted here of course)


So far so good. Now it comes…

I changed to photo mode and the next image I got (and all afterwards) have been tagged to be 1024 x 768 (OK) with the HFOV and VFOV of the last zoom stage 3 of the video (this is, what I would consider to be not OK).


While the image is really 1024 x 768, I can’t believe the HFOV and VFOV.

Could you please try to elaborate?

As a little side issue I was noticing different HFOV and VFOV, but just if I use your official app to switch between photo and video.

In video mode the vmeta for HFOV, VFOV reads like so:

(<VMetaFrameType.PROTO: 6>, {‘drone’: {‘quat’: {‘w’: 0.8680419921875, ‘x’: 0.0211181640625, ‘y’: 0.03900146484375, ‘z’: -0.494384765625}, ‘ground_distance’: 0.4555206298828125, ‘speed’: {‘north’: 0.0, ‘east’: 0.0, ‘down’: 0.0}, ‘battery_percentage’: 47, ‘flying_state’: ‘FS_LANDED’}, ‘camera’: {‘timestamp’: 110000074, ‘base_quat’: {‘w’: 0.8690185546875, ‘x’: 0.0, ‘y’: 0.0, ‘z’: -0.49462890625}, ‘quat’: {‘w’: 0.8690185546875, ‘x’: 0.0, ‘y’: 0.0, ‘z’: -0.49462890625}, ‘exposure_time’: 30.0390625, ‘iso_gain’: 1118, ‘awb_r_gain’: 1.967529296875, ‘awb_b_gain’: 1.852294921875, ‘hfov’: 1.2042771577835083, ‘vfov’: 0.7377424836158752}, ‘links’: [{‘wifi’: {‘goodput’: 11017, ‘quality’: 5, ‘rssi’: -49}}]})

while in photo mode I get this:

(<VMetaFrameType.PROTO: 6>, {‘drone’: {‘quat’: {‘w’: 0.8695068359375, ‘x’: 0.02117919921875, ‘y’: 0.038818359375, ‘z’: -0.49188232421875}, ‘ground_distance’: 0.3879852294921875, ‘speed’: {‘north’: 0.0, ‘east’: 0.0, ‘down’: 0.0}, ‘battery_percentage’: 46, ‘flying_state’: ‘FS_LANDED’}, ‘camera’: {‘timestamp’: 149424533, ‘base_quat’: {‘w’: 0.870361328125, ‘x’: 0.0, ‘y’: 0.0, ‘z’: -0.4923095703125}, ‘quat’: {‘w’: 0.8702392578125, ‘x’: 0.0, ‘y’: 0.0, ‘z’: -0.49261474609375}, ‘exposure_time’: 30.0390625, ‘iso_gain’: 1071, ‘awb_r_gain’: 1.92138671875, ‘awb_b_gain’: 1.849609375, ‘hfov’: 1.3177236318588257, ‘vfov’: 1.05217444896698}, ‘links’: [{‘wifi’: {‘goodput’: 16905, ‘quality’: 5, ‘rssi’: -44}}]})

I cannot reproduce this difference, if I use API functions to switch between photo and video.

For both modes these readings came way closer to my calibration results then what I have reported above… Is there any other secret switch I don’t know about? Or is this a “special” photo mode you are setting in your app?

I have really difficulties to understand, could you please explain?

When I setup the drone via the Freeflight app to use photo mode and entering my app (w/o switching mode, zoom or whatever), I’m reading these values for width, height, hfov and vfov from the stream

1024 768 1.3177236318588257 1.05217444896698

If I switch to video mode, these settings change to

1280 720 1.2042771577835083 0.6954046487808228

If I repeat that photo/video switch in my app several times, then it might show the same results as above for one or two more attempts, but finally it lands here:

1280 720 1.2042771577835083 0.6954046487808228
1024 768 1.2042771577835083 0.6954046487808228

Can you explain me that?

Here my photo/video switch methods. What am I missing?

    def set_photo_mode(self):
        ''' Set photo mode '''
        if not self.drone.connection_state():
        self.logger.info("set photo mode")

        self.drone(camera.set_camera_mode(cam_id=0, value='photo'))

        self.logger.info("photo mode set")

    def set_video_mode(self):
        ''' Set video mode '''
        if not self.drone.connection_state():
        self.logger.info("set video mode")

        self.drone(camera.set_camera_mode(cam_id=0, value='recording'))
        self.photo_video_mode = 'video'
        self.logger.info("video mode set")

We will investigate this live streaming metadata consistency issue.

Could you please reproduce it and share the logs from the drone (the logs.bin files that you can get from the drone web server when connected to your drone wifi SSID). Thanks

Ok, to recap what I did:

  1. I used the Android Freeflight app in order to set the drone into photo mode (since it was already in photo mode I switched back to video and then to photo again)
  2. I left the app
  3. I started my app, not changing photo/video mode and zoom
  4. I switched back and force between photo and video using the routines shown in my initial post regarding this
  5. I observed width, height, hfov and vfov as reported in the stream meta data using the extraction methods shown in my initial post
  6. I could confirm my observations reported in the initial post: While the drone is initially reporting different hfov and vfov values for photo and video mode, it later levels that and reports just the video values for both resolutions/modes.
  • With photo mode set from the Freeflight app it starts with:

1024 768 1.3177236318588257 1.05217444896698

  • I switch to video:

1280 720 1.2042771577835083 0.6954046487808228

  • Back to photo:

1024 768 1.3177236318588257 1.05217444896698

  • Back to video:

1280 720 1.2042771577835083 0.6954046487808228

  • Back to photo:

1024 768 1.2042771577835083 0.6954046487808228

  • From now on I get the same hfov/vfov for photo and video (well, sometimes with slight variations from the first or fourth digit after the decimal point, but generally the same). A restart of the script (reconnect to the drone) doesn’t change that. Only the repeated use of the FreeFlight app returns to the initially reported hfov/vfov values for photo mode, until it goes again to the same values while using my app.

I have a “bin” recording. Will try to attach it here, but it is 190 MB, I doubt it will work

EDIT: As thought, can’t upload it here. I will ask Daniel to forward you the dropbox link by mail

This topic was automatically closed after 30 days. New replies are no longer allowed.

Thanks for the logs received via private messages. We’re still investigating this issue.