| Version 1 (modified by mark1, 4 weeks ago) (diff) |
|---|
Using aplbore
This is a checklist guide to using the aplbore software to assist with boresighting of the SPECIM instruments. The procedure is run using the boresight_with_aplbore.pyscript which takes a config file as input. An example config file boresight_with_aplbore.cfg is available.
Before beginning, all the data should have been processed through APL already (using boresight of 0 0 0) and have the SCT timing corrections finished. Any flightlines which look dodgy (uncorrectable timing, unrecorded dropped frames, nav issues) should be left out of the below procedure if there are enough other lines to use. The APL processed data (if done in the usual file structure) will be located in the processing/**SENSOR**/flightlines directory. The georeferencing/mapped directory contains the mapped (resampled) data and the rowcol file.
Stage 1: create shapefile of tie points
The first thing to do is collect suitable tie points into a shape file. If you have measured / surveyed points that are visible in the SPECIM imagery then this is great. If not then this requires a high resolution georeferenced dataset to create the tie points from. Worst case is to use QGIS together with a vector background such as openstreetmap (or any other georeferenced map data freely available). Select points that are visible / identifiable on the SPECIM data and name them using a column called "id" with an integer value and save into a shapefile layer. An example shapefile for a boresight over Brazil can be seen here:
The information needs to go into the config file. The config file has two mandatory sections:
- system: under this tag there needs to be the location of the aplbore executable (aplbore_exe)
and whether to output debug information.
- tiepoints: this has the filename key which stores the location of the tie point shapefile
The remainder of the config file is made up of entries for each flightline used in the process. Details of this are in the below sections.
We can start to create the config file now.
Example config file entry
system:
aplbore_exe: "/users/rsg/mark1/codereview/aplsuite/bin/aplbore"
debug: False
tiepoints:
filename: "/users/rsg-new/mark1/scratch_space/usertests/me/boresight_tests/stuff/boresight_test_points.shp"
Stage 2: identify locations of tie points on imagery
Next is to identify the tiepoints on the SPECIM imagery in the level1 file to get the row/col of the data that the tie point occurs in. The easiest way to do this is to load the mapped imagery into QGIS together with the rowcol file (created from aplmap). Then identify the tie point on the mapped image (click it to get the data values) and note the col/row data from the rowcol file (see image below). These data need to go into the configuration file for running boresight_with_aplbore.py. Enter the details into the section of the config file for that line (labeled lineN where N is an integer id for that line). The data should be entered as a list as [sample, row] under the key targetN where N is the integer id for the tie point, matching the id in the shapefile.

Note that you will be able to more acurrately identify the tie point location by zooming in rather than using an overview of the whole flightline.
Example config file entry
line1:
target1: [209,2119]
target2: [371,2265]
target3: [742,2425]
Other key and value entries for the line include the view vector file for the sensor used in aplcorr, the level1 file and the APL navigation file from aplnav.
Updated example config file entry
line2:
navfile: "/users/rsg-new/mark1/scratch_space/usertests/me/boresight_tests/processing/hyperspectral/flightlines/navigation/interpolated/post_processed/f271021b_p_sct0.09_nav_post_processed.bil"
l1file: "/users/rsg-new/mark1/scratch_space/usertests/me/boresight_tests/processing/hyperspectral/flightlines/level1b/f271021b_p_sct0.09.bil"
vvfile: "/users/rsg/arsf/calibration/2025/fenix1k/fenix1k_fov_fullccd_vectors-backwardsmount.bil"
target1: [209,2119]
target2: [371,2265]
target3: [742,2425]
Repeat this for each flight line that you want to include in the process. It is recommended to use multiple flightlines (at least 3) with differing flight directions for best results. The more tie points used the better, as you will be able to remove ones that are not good and still get usable results.
Stage 3: run the process
The config file is now created and we can run the process. This is as simple as running boresight_with_aplbore.py --cfg <config>
The output will look something line this:
Boresight estimates (roll, pitch, heading): [-0.13623 0.37172 0.55392]
Errors for tiepoints ... you could use this to identify poorly resolved points
(lowest numbers are best fit, higher numbers are poor fits):
line2 line3 line9
target1 0.001697 0.000408 NaN
target2 0.001693 0.000688 NaN
target3 0.003850 0.002483 0.002626
target4 0.006575 0.004131 0.003100
target5 0.004145 0.003911 NaN
target6 0.002164 0.001130 0.000662
target7 0.003869 0.001849 NaN
Remember that the processing configs expect boresight to be given as Pitch, Roll, Heading. i.e. 0.3717 -0.1362 0.5540
The error table gives information on the error (distance between true and derived vectors). The larger the number the higher the offset between truth and mapped data is for that tie point. Where it says NaN that is because those tie points where not used on the line in question. If a point had a very high error (in comparison to the others) then it is worth removing it and repeating as it may be located incorrectly.
Reprocess the data in APL using the boresight and re-run the boresight_with_aplbore.py script. The offsets should now be much smaller. If still significant (e.g. > 0.001) then it may be worth adding these offsets on to the previous ones and repeating. There should be no need to run the process more than twice if tie points are accurate.