Modifying older collections for Pix4Dfields support

If you would like to use Pix4Dfields to process data captured with a RedEdge camera before upgrading to firmware version 3.4.0, there is a way!

Obtaining the right metadata

First, obtain the rig relative values for your camera using the steps below:

  • Update the firmware to the latest version (3.4.0 or higher) via atlas.micasense.com
  • Connect to RedEdge wifi, and visit http://192.168.10.254/calibration/rig_relatives in a web browser.
  • If the camera has the required calibration, it will display it. Save the rig relative data for use in modifying older image metadata:
{"1": [0.2, 0.1, 0.2], "2": [0.1, 0.2, 0.1]...
  • If not, a message should appear stating "No rig relative calibration available" and the camera requires an update, found here.

Modifying the images

The images can be updated using a third-party metadata tool like exiv2 or exiftool. In these examples, we have built scripts around exiv2.

Jump to MacOS/Linux

Windows

The following is an example batch script. To use it, copy it and save it with a .bat extension. The file must be modified to include your camera's specific rig relative numbers. Once saved, you can run this batch script in the folder that contains the images you would like to modify.

The camera reports the rig relatives in the following format:

{"1": [-29.659901341322005, 0.6433726450048046, -0.014244532370922039], "2": [0, 0, 0] ...

So that means that cal[1] in the batch script would need the values from band "1", which in this example are -29.659901341322005, 0.6433726450048046, and -0.014244532370922039. 

Batch Script (*.bat)

@echo off
setlocal enabledelayedexpansion

set cal[1] = -29.659901341322005, 0.6433726450048046, -0.014244532370922039
set cal[2] = 0, 0, 0
set cal[3] = -0.3034849520908068, -21.326642231053118, -0.8374944622340491
set cal[4] = -28.88942070783364, -21.912151930283546, -0.0692748535739252
set cal[5] = -14.676537573848027, -10.658947918332823, -0.28212116158984546

rem Set this to 6 to populate all data. Set to 1-5 to not populate for the specified band
set referenceBand=6

for /L %%i in (1,1,5) do (
   for /D %%f in (*) do (
      set str=exiv2.exe -M"reg Camera http://pix4d.com/camera/1.0" -M"del Xmp.Camera.RigRelatives"
rem      for %%a in (!cal[%%i]!) do (
rem         set str=!str! -M"set Xmp.Camera.RigRelatives XmpSeq %%a"
rem      )
      if NOT %%i==%referenceBand% (
         set str=!str! -M"set Xmp.Camera.RigRelatives XmpText !cal[%%i]!"
      )
      call !str! "%%~ff\*_%%i.tif"
   )
)

 

MacOS/Linux

The following is a python script and it will need to be modified to replace the full path to the images you would like to modify as well as the rig relatives from the camera.

The camera reports the rig relatives in the following format:

{"1": [-29.659901341322005, 0.6433726450048046, -0.014244532370922039], "2": [0, 0, 0] ...

Paste the camera's rig relative output as the input to the "data" variable. 

data = {"1":[-0.001124786806262602,0.002246393091745302,0.003988365590638233],"2":[0,0,0],...

Run the script in a terminal window, giving it the path to the folder where the images are stored, including the trailing slash (/).

python rigrelatives.py /Users/username/uploads/flight_1/images/

Python Script (*.py)

import os
import sys
import math

# Put your calibration data in the line below. Connect to camera wifi and visit http://192.168.10.254/calibration/rig_relatives for the string
# For example: data = {"1":[0.1,0.2,0.3],"2":[0,0,0],"3":[0.4,0.5,0.6],"4":[0.7,0.8,0.9],"5":[1.0,1.1,1.2]}

data = None # Paste rig relatives from your camera here. if data == None: print "Paste rig relatives string from your camera into the 'data' variable. Connect to camera wifi and visit http://192.168.10.254/calibration/rig_relatives to obtain the string" exit(1) if len(sys.argv) < 2: print("Please provide a directory to update.\nUsage:\n\tpython %s /path/to/your/images" %sys.argv[0]) exit(1) img_dir = sys.argv[1] def rad2deg(x): return x * 180/math.pi for f in os.listdir(img_dir): if ".tif" not in f[-4:]: continue i = int(f[-5:-4]) modrels = map(rad2deg, data[str(i)]) print i, modrels cal = ",".join(str(s) for s in modrels) command = 'exiv2 -M"reg Camera http://pix4d.com/camera/1.0" -M"del Xmp.Camera.RigRelatives" -M"set Xmp.Camera.RigRelatives XmpText ' + cal + '" "' + img_dir + f + '"' #print(command) os.system(command)

 

Have more questions? Submit a request