A pipeline to prepare rosbags for Pix4d mapper, create google tiles from Pix4d products, and host the tiles to be used as backdrop in mission planner. It explains the extraction of images, ground control points and camera calibration configs. From a successfully completed optimised Pix4D map, you can export the orthomasaic as tiles that can be loaded by the mission planner for visualisation.
Run the script fm_export_pix4d
as follows:
fm_export_pix4d ~/bag_file/location ~/target/directory
or more explicit
fm_export_pix4d ./sensors_2021-02-23-12-34-58.bag ./pix4d/ --pos-topic /owl/piksi/position_receiver_0/ros/navsatfix --rgb-topic /owl/bfly/synced_throttle/image_raw --gcp_path /home/rik/data/2021_02_23_sur/position_samples/gcp --cam_calibration /home/rik/data/2021_02_23_sur/bags/bfly.yaml
This will generate an rbg image collection with geotags in the image headers, search for ground control point samples near the bag and copy the camera calibration parameters to the target folder.
If a "ground true" position is available, the map can be corrected with the error between the true and the sampled position. This is applied by adding the options '--base_ground_truth_path' and '--base_sampled_path':
fm_export_pix4d ~/bag_file/location ~/target/directory --base_ground_truth_path ~/true/coordinates/file --base_sampled_path ~/sampled/coordinates/file
The file with the true coordinates have to be of the following form (it's looking for 'Lat, Lon, Alt', the ppk solution will have the matching output):
Lat: 46.690704768
Lon: 7.64729512512
Alt: 674.650719512
For information about advanced settings type use the -h
option.
If a ground true position is available, one could correct gcps right on the field. This can be done by:
fm_gcp_correct gcp/file/locations/ target_path_for_files/ --base_ground_truth_path base_true.txt --base_sampled_path base_sampled.txt
- Make sure you have the generated files from above ready
- Create a new project in pix4d
- Select the rgb image folder
- Make sure pix4d detected the geolocation
- Select the camera model
BlackflyS_IM265
or create a new one with the params fromcam_calibration.yaml
- Select the standard 3d map as processing option
- Open the GCP manager
- Open
Edit
the GCP coordinate system and tick advanced coordinate options, 'select from list' - Select
wgs84
(top of the selection) for the coordinate system (Datum remains unchanged) - Select gcp_summary.txt with the option
latitude, longitude, altitude
- Open
- Start only step "1. Inital Processing"
- Mark the gcps using rayCloud (select 3 or 4 and then do "auto-detect" for the rest)
- Click reoptimize
- perform processing steps 2. and 3. with desired settings.
- Open "Processing Options / 3. DSM..." and tick "Google Maps Tiles and KLM"
- Visualize on google maps
- Click the .html file in the project folder
pix4d/project:name/3_dsm_ortho/2_mosaic/google_tiles
- Click the .html file in the project folder
- Visualize in any gis
- .tif files are generated for dsm and orthomosaics (see projectfiles at
pix4d/project/3_dsm_ortho/2_mosaic/
)
- .tif files are generated for dsm and orthomosaics (see projectfiles at
See fm_mission planner README.md
This is the process of copying the tiles generated by Pix4D to a local repository that can be accessed by the mission planner.
- Copy the folder
google_tiles
which is in the location
pix4d/project_name/3_dsm_ortho/2_mosaic/google_tiles
to your linux environment (the computer that you want to use as a base station for mission planning). Let's assume you place them in ~/google_tiles
.
- Then run the script
fm_tile_tf
on the tiles. This will convert and copy the tiles from the original google tiles format in the input directory (-i
argument) to the TMS format in the target directory (-m
argument) that can be used as a source for mission planning
fm_tile_tf -i ~/google_tiles -m ~/map_tiles
- If using a file management system for all tiles, commit changes in
map_tiles
and push to the data server (instructions)