Shooting in RAW (DNG) with the Parrot Anafi and Pix4D Capture

Caution

– It is possible that switching applications and disconnecting the USB cable during flight may disrupt the proper operation of the drone. I didn’t have a problem but use this method at your own risk.
– These tests were performed with a Parrot Anafi 1.2.4, SkyController 1.2.0, an iPhone 5S on iOS 12, the FreeFlight 6.2.1 application. YMMV.

Pix4D Parrot Anafi record RAW DNG FreeFlight reconnected

The Pix4D Capture application is very well designed to prepare flight plans, whether grid, double grid, polygon or circular. Preparing a flight plan is very simple, even on a small smartphone and all the important settings such as camera coverage or tilt are present. The only downside when doing photogrammetry with Parrot Anafi and Pix4D Capture, the app only records JPGs and this is also the case with other drones such as DJI’s.

Fortunately, it is possible to overcome this limitation with the following steps:

  1. Turn on Anafi and connect your smartphone to the SkyController3
  2. Open Pix4D Capture and create a flight plan
    Pix4D Parrot Anafi record RAW DNG photos with Pix4D Capture
  3. Click on the “Start” button at the bottom right in Pix4D Capture. Skip the screen that asks you to connect to the drone. The checklist is shown, this is the moment when the app writes the flight plan on the Anafi. Click on Cancel.

    Pix4D Parrot Anafi record RAW DNG photos drone takeoff checklist

    Once “Mission uploaded to drone” is in green, press “Cancel”

  4. Launch the FreeFlight application and go to the “Fly” screen.
    Pix4D Parrot Anafi record RAW DNG FreeFlight Pix4D switch

    Pix4D Parrot Anafi record RAW DNG FreeFlight not connected

    FreeFlight will display this screen until the cable is reconnected

  5. Reconnect the smartphone to the SkyController3 with the USB cable.
  6. Modify the photo settings: DNG/JPG, Style, iso, shutter speed. You can choose all the parameters at your convenience, they will then be used during the automatic flight.
    Pix4D Parrot Anafi record RAW DNG choose photo settings
  7. Disconnect the USB cable that connects the smartphone to the SkyController3.
  8. Switch back to the Pix4D Capture application
  9. Reconnect the USB cable
  10. Wait for pix4D to reconnect to the Anafi and then press “Start” again at the bottom right of the screen. And this time, on the “Drone take off checklist” screen, we will not click on Cancel but on Start. The Anafi takes off immediately and begin its automated flight.
    Pix4D Parrot Anafi record RAW DNG photos drone takeoff checklist

That’s it! The Anafi will take all the following pictures in DNG+JPG with the settings you have chosen in FreeFlight.

Pix4D Parrot Anafi record RAW DNG exif ISO 3200 shutter speed 1-4000

We do have an exposure time of 1/400 and ISO at 3200 as previously defined in FreeFlight

Pix4D Parrot Anafi record RAW DNG gallery

DNG photos in FreeFlight’s SD card explorer

After the flight, it will not be possible to continue with the Pix4D workflow, the application will not be able to download the photos from the Anafi after the mission, which is quite normal since it was not designed to do so.

Pix4D Parrot Anafi record RAW DNG photos arror when uploading images

Pix4D Capture will not be able to recover the photos if we force the Anafi in DNG, the application is not designed for that.

But it will of course still be possible to retrieve the geotagged DNGs from the Anafi SD card, convert them to TIFF and then use them in Pix4D or any other photogrammetry software.

Unfortunately, the Anafi is not able to record DNGs as fast as JPGs, it will need between 4 and 5 seconds between each picture. It will therefore be necessary to modify some settings:

  • Reduce flight speed (and therefore increase flight time and probably reduce the area covered)
  • Reduce overlap (which is not recommended, the default settings of Pix4D 80% ↕ and 70%↔ are suitable for most projects, decreasing them could complicate or make it impossible for the photogrammetry software to do its job )
  • Increase altitude (and therefore decrease GSD and slightly increase flight time)

Or a mix of the 3 that can be defined according to a careful calculation. We therefore lose some of the advantages of the Pix4D application, which in normal operation would completely abstract this type of problem.

Pix4D Parrot Anafi record RAW DNG HoudaGeo Pix4D Capture

24 photos were taken instead of the 44 initially planned because of the recording time of the DNG (4 to 5 seconds)

Pix4D Parrot Anafi record RAW DNG HoudaGeo Exif timestamp

Examining the exif, we can see that it takes between 4 and 5 seconds for the Anafi to save the pictures in DNG

Photogrammetry with Parrot Anafi and Pix4D Capture

Flight preparation

Flight planning is very simple thanks to the intuitive interface ofPix4D Capture. The flight plan is ready in a few minutes and all the necessary settings are present.

Photogrammetry with Parrot Anafi and Pix4D Capture flight plan on iPhone 5S

It is possible to download maps (Mapbox or Apple) for offline use once on site in case there is no internet access. To do this, simply open Pix4d and go to the area you want to cache and wait until the map is correctly loaded (until all the tiles on the map have appeared in their best possible resolution)

During the flight

The flight went very well and even if the UAV did not go very far (no more than 300 meters) the video feedback was quite stable despite some one-second freezes when the UAV passed behind the building and a very low definition video feedback from time to time (better than freezes), overall the flight went perfectly, it’s easy to switch between the map and the video feedback to see the progression of the UAV and any obstacles that would appear on the road. Especially since the Anafi is programmed by Pix4D to keep the “nose” facing forward.

You will still have to be careful not to touch the radio control sticks when touching the phone screen, which would result in switching back to manual piloting mode and pausing the mission. Not a major problem since you simply have to press “Resume” to continue the automatic flight.

The video feedback does not make a black screen with each trigger but Pix4D indicates the pictures taken on the card, well almost, Pix4D displays the position at which the trigger command was sent but the app does not receive any feedback confirming that the picture was taken.

Photogrammetry with Parrot Anafi and Pix4D Capture video feedback

Upon landing, you must remember to point the camera towards the sky to protect it from everything that will fly when the drone lands, especially if it is on sand or gravel. Pix4D does not add a “Camera at +90°” waypoint before landing. Even if you touch the gimbal’s tilt trigger, the landing will continue and the Anafi will not return to manual piloting mode.

During the flight you can follow all the information on the status of the Anafi: Percentage of the battery, speed, altitude, number of satellites, space available on the SD card and distance to the home or smartphone point. To display all this information it is preferable to have a screen larger than 4″, it is a bit narrow on an iPhone 5S and some information is hidden.

Photogrammetry with Parrot Anafi and Pix4D Capture flight hidden informations on iPhone 5S

After the flight

The Anafi landed with 23% of battery power after a 19 minutes and 51 seconds flight at 3°c

With the default settings of Pix4D Capture, uploading photos to the phone is automatically started as soon as you land. There was a slight bug during the download of the images but it resumed on its own afterwards and all the images were copied.

Remember to keep some battery for photo transfer. For 359 photos (1.96 GB, average 5.46 MB / photo) with an iPhone 5S it takes about 20 minutes. It should be enough most of the time, but if you land at 2% not sure. Automatic photo transfer can be disabled in the application settings.

Photogrammetry with Parrot Anafi and Pix4D Capture downloading images after flight

The images downloaded by Pix4D Capture and saved on the phone are correctly geotaged. On the SD card of the Anafi we find almost exactly the same thing, the geotagged JPG photos. Only one small difference, on the SD card there are 3 more pictures, including 2 taken after the flight, during the transfer of the pictures and the third additional, well I don’t know… Probably during the flight, it may be due to the involuntary pause during the automated flight when I accidentally touched a stick on the radio control. Not a big issue anyway. The pictures will just need to be discarded, be it manually, or by the photogrammetry software.

The photos can then be uploaded to the Pix4D cloud to perform the calculations and rendering directly on pix4D servers. Uploading photos to the Pix4D cloud requires a valid license. It is possible to get a 15-day trial license by creating a Pix4D account here: https://account.pix4d.com/signup. Then download the Pix4D software and click on the “Click for trial” button at the top right of the interface.

Photogrammetry with Parrot Anafi and Pix4D Capture upload images Pix4D cloud

With the default settings, downloading photos from the Anafi starts immediately after landing

No RAW

Pix4D only backs up JPGs, the Pix4d Mapper software does not know how to use RAW. It’s a shame we would have liked to be able to recover the DNGs from the Anafi and convert them into geotagged TIFFs that Pix4d Mapper can read. It seems to be the same thing with DJI drones.

But even if it were possible, we would have to make sure to have an SD card with a good capacity since for this flight of 359 photos, if we consider that the DNGs are on average 48 MB it would take 17.2GB to store the photos. And the flight could even have lasted a few minutes longer.

RAW recording is a feature that has not yet been developed and may not be used if you consider that it takes between 4 to 5 seconds for the Anafi to record a DNG photo (~48 MB), so you should decrease the flight speed, decrease overlap or increase altitude and therefore decrease GSD. Not to mention that it would take a lot of extra time to download the photos from the drone as well as upload the photos to Pix4D cloud.

Update: there is actually a way (not official) to record DNGs with Pix4D Capture.

Photo quality

There is a little motion blur in most of the pictures. The flight was made at about 2.7m/s but the proximity of the ground (30 meters) and the low light on that day did not help.

According to the Exif, it seems that Pix4D leaves the shutter speed and ISOs free, the focal length being fixed (f/2.4) on the Anafi. This is very good since we prefer to block the aperture for photogrammetry anyway in order to minimize lens distortion variations between each picture.

  • Focal length: f/2.4
  • Shutter speed: between 1/25 and 1/100
  • ISO: between 103 and 206

Photogrammetry with Parrot Anafi and Pix4D Capture photos EXIF geotagged

Pix4D Parrot Anafi photogrammetry photo JPG

Open the full resolution image (5344 × 4016 | 5.6 MB) in a new tab

Conclusion

The application is really very well designed and pleasant to use, without reading the instructions, without creating an account without struggling to create a mission on a small 4″ screen you can easily get a correct result. In fact, I don’t think I’ve ever planned a flight so simply. The switch from the video feedback screen to the map view is seamless and that’ s good because it’s something frequently required during the flight, you just have to be careful not to touch the radio control sticks. It would have been nice to be able to record the raws, the only thing to blame on Pix4D Capture. The Anafi is also very pleasant to use, it is very compact, light, we are really not afraid to take it anywhere and considering the place it takes it would be a shame not to. The possibility of charging the battery on a USB cigarette lighter socket or an external battery is also a plus. The drone is very quiet a few dozen meters from the ground.

It is for me the simplest, most intuitive and portable solution available on the market today for taking photos and photogrammetry. The drone weighing less than 800 grams also helps to avoid a lot of administrative hassle and is also more reassuring to fly, especially since it is not excessively expensive. It remains a 1/2.4″ sensor that will clearly not stand up to the cameras on heavier drones, but let’s say it’s a solution that offers a very good volume/weight/price/image quality ratio.

Flight Plan add-on for FreeFlight

I was hoping for this “in-app purchase” to make flight plans but even if this add-on Flight Plan from the FreeFlight application which allows you to plan flights seems rather well designed for automated videos, it will be useless for photogrammetry. You would need to create every waypoints manually, which would be a bit tedious in the case of a grid with 200 waypoints or even a circular flight plan with 30 waypoints.

Precautions

  • Plan several or a large SD card if you want to make several flights, it fills up very quickly (~2GB / flight).
  • Do not press the home button on the phone (at least not on iOS). Even if you restart Pix4D quickly, the application will have lost the connection with the drone and you will have to disconnect and reconnect the USB cable that connects the phone and the radio control to restore it.

Result

580,000 polys. Texture 8192×8192.

A Node.js module to read serial port data

node.js serialport npm sublimeText screenshot

Serialport is a node.js module that reads the serial port data. It opens up a lot of doors for javascript such as… switching on the living room light or… communicate with a drone !

Using it is pretty straightforward

npm install serialport

Note

Serialport installation requires
python 2.x and Xcode command line tools
For the Command line tools, no need to download the whole Xcode app (which is a few Gygabytes), you may download only the command line tools here

We’ll then create a server named server.js and copy the following code into. You may need to replace the baudrate, 57600 is the default baudrate for Ardupilot on APM. You will very likely need to replace “tty.usbserial-A6023L0J” with the name of your device. On macOS and GNU/Linux  ls /dev/tty.*  to show connected devices.

The following lines in App.js are configuring and initalizing the websocket connection :
var io = require(‘socket.io’).listen(server);
io.sockets.on(‘connection’, socket);

Let’s launch the server :  node server.js

If an APM with Ardupilot or an equivalent device is connected to your computer, the terminal should display the console.log which looks like that :

node.js serialport

Serialport allows you not only to read but also write data on the serial port, which let envision many possible uses. If you are interested, here are two interesting posts on the subject. The first one about controlling an Arduino with Node.js and the second one on Javascript and Robotics by the Author of the serialport module :

http://brandontilley.com/2012/03/02/controlling-an-arduino-from-nodejs.html

http://voodootikigod.com/nodebots-the-rise-of-js-robotics