Georeferencing Area Targets¶
Georeference Area Targets to obtain the geolocation of their origin and rotation-angle with respect to the WGS 84 geographic coordinate system. We describe three different options to achieve this below.
Georeferencing your Area Targets with one of the below described methods allows you to use the geolocation of the device as External Prior for Area Targets based experiences, especially in large spaces. Once you have determined the latitude and longitude of the Area Target's origin, and its orientation's CCW (counterclockwise) rotation angle with respect to the North direction, you can follow the Use Device Geolocation as Prior guide to build your app.
Method 1: Geo-locate the Original Scan of the Area Target¶
Some scanning solutions provide facilities for geo-registration and alignment of the scan. If this data is available, the Area Target generation will respect the origin of the input scanned data.
- Register the origin of the scan with the scanning provider's software.
- Preserve the origin's geolocation as information for your app if you need to align assets to this coordinate system or if you have other offsets to deal with. Have the latitude and longitude of the scan data's origin, and its orientation as a CCW rotation angle with respect to the North direction ready for development.
NOTE: Area Targets are defined with an upwards pointing Y-axis, so it may be necessary to perform an additional rotation to make everything Y-up if the scanned input data uses a different convention.
Vendor specific information:
- When using NavVis scans, your scan is created in IVION and can be geo-referenced during the data import. This reference will be retained during the processing of the raw scan data into the E57 artifact. See further information in the NavVis documentation.
- Leica REGISTER 360 can align scans during import using the built-in Geo-Image alignment support, or by using a list of geo-referenced control points, that you can apply to your registered bundle. Using the RTC360 you can also leverage the measurement of the on-board GPS sensor for auto-alignment. Consult the Leica Cyclone REGISTER 360 quick start guide or the built-in documentation of the tool.
With the retrieved latitude and longitude, and rotation you can start to Use Device Geolocation as Prior.
Method 2: Manual Alignment of Authoring Model with Satellite Imagery¶
Estimate the alignment manually in the Unity Editor using a top-down view of the Area Target authoring model with a paired satellite image. The accuracy of this approach will depend on how easy it is to visually align the scanned location with the information visible on a satellite image. In addition to the Unity Editor, you will need an image editor for the alignment.
Follow the below steps:
-
Look up your scan location using any mapping service that shows enough detail to align your Area Target which also allows you to read out exact coordinates. In this example we'll use Google Maps to look up the "Area Target Sample" target -- which shows the Customer Experience Center at our Headquarters in Seaport, Boston, MA.
NOTE: we are using the Map view, and not the Globe view mode. This might yield some errors on tall buildings in some places but some of the below steps don't work with Globe view.
-
Mark-up a known distance in the map with the ruler tool to aid scaling later below in Unity.
-
Capture the satellite image with the scale marked. To aid alignment in Unity, crop the image in an image editing tool to be square.
-
Import your Area Target into the Unity Editor as described in the
-
Verify the origin of your AT in Unity to be at (0,0,0). Make sure to select the Pivot mode, to see the true origin location of the local coordinate system (and not the center of the GameObject).
NOTE: The origin of the scan can lie outside of the actual area covered by the Area Target due to original scan-processing or Space-3DT cropping in ATG as in this example.
-
Switch to Unity’s Scene View to orthographic mode in a top-down view by clicking the cube in the middle and the green cone.
Selecting the Area Target will display its origin with an axis gizmo.
-
Import the captured image into Unity Editor as an asset, create a new plane GameObject, and apply the image as its texture. Per default the plane is square. Cropping the image in the previous step helps keeping the aspect-ratio correct, otherwise you need to correct for that at this point. Switch the transforms for this GameObject from Global to Local.
-
Scale the plane uniformly, so that the ruler’s scale coincides with Unity’s grid – in below example 20m is around the second gridline from origin. If you have done it correctly, the Area Target and the satellite image should be the same scale and size-wise fit each other. Remember, everything is in meters in the Unity Editor. The resulting scale factor – here 9.332943 – is arbitrary as it depends on the zoom factor in maps.
-
Translate and rotate the plane to georeference the Area Target. The local coordinate system of the plane GameObject will move and rotate. Originally the blue Z axis of the plane was aligned with the North direction. To align with the Area Target, we have to rotate the satellite image to provide the CCW rotation with respect to the North direction angle = 95 degrees.
-
Find the Area Target's origin location in the satellite image by selecting the Area Target and zooming in around (0,0) in the Scene View. Since the Area Target is still located at the origin (check to use Pivot!) and we moved the map underneath, the point on the map under the Area Target's (0,0) origin will be our reference point -- the geolocation of the Area Target's origin.
-
Look-up the origin' geolocation on a mapping service (on Google Maps right-click the origin's location). By clicking on the coordinates in the context menu, pick up the
(latitude,longitude) =
(42.35072572772756, -71.04457501396098)
.
With the retrieved latitude and longitude, and CCW rotation angle to the North direction you can start to Use Device Geolocation as Prior.
Method 3: Align by Using Measured Area Target and GPS-device Poses¶
This method may be convenient if the other described methods for georeferencing are not possible, or if you wish to verify the results of one of the other methods. It uses a Python script and an input file that contains measurements to align an Area Target pose with the geolocation of the Area Target's origin. The resulting accuracy depends on the quality of the measurement data provided.
Approach 1: Collecting sample location data off-line on your Desktop¶
The best results may be achieved by identifying well defined sample locations in the target (building corners, roof-windows, A/C-unity, or road markings) whose geolocations can be relatively accurately looked-up from satellite imagery and identified with the Area Target's Authoring Model.
Area Target Coordinate System | Geolocation in WGS 84 ("GPS position") | |||||
---|---|---|---|---|---|---|
X | Y | Z | Latitude | Longitude | Altitude | |
Sample location 1 | -10.0 | 1.0 | 0.0 | -65.814396 | 125.076176 | 2.94844144 |
Sample location 2 | 10.0 | 1.0 | 0.0 | -65.814554 | 125.076076 | 2.08687038 |
... | ... | ... | ... | ... | ... | ... |
To measure locations within the Area Target in the Unity Editor, create an empty GameObject, and name it e.g., as "Sample location 1". Select the GameObject to reveal its origin with pivot selected. You can now move and rotate the gizmo to align with your sample locations in your scene.
Find the same locations in the satellite image and match their geolocation as showed in the above example table.
This approach works well in situations, where objects or pieces of the environment in the captured location can be identified and they are visible from above -- such as they are visible in a satellite image.
Approach 2: Collecting sample location data on-site with a Mobile Device and a custom app¶
Alternatively, the data for above table may also be collected by measuring and logging pairs of data with a simple, custom-built app. This app should read Vuforia Area Target Poses and GPS-positions at various sample-locations within the environment.
The GPSLocationProvider.cs
script in the Use Device Geolocation as Prior page shows how to read out the GPS position.
To capture the device's location within the Area Target coordinate system at runtime you must transpose the device location with the following snippet.
This method may give a less accurate results since live GPS measurements in or around buildings are likely to have a few meters of error. In this case, the best action is to take several widely spaced measurements around the target in locations where GPS accuracy is as good as possible.
Prepare the alignment data file¶
Getting enough and good-quality measurements depend on the GPS signal strength and accuracy. We recommend getting at least a few sample locations with more than a meter between them when the data is considered accurate, and up to a dozen sample locations if the GPS measurements are considered inaccurate.
The alignment Python script in the next section expects an input file with pairs of device positions in the Area Target and geolocations. An example alignment-input.txt
file shows the expected format:
Align Area Target poses with GPS coordinates¶
Finally, below you can find the Area Target Geo-Location Estimator Python
script that aligns Area Target poses and the GPS coordinates as collected and provided in a formatted input file.
NOTE: This script only works for 2D alignment of the Area Target.
NOTE: To run this script, your Python installation must have the dependencies; argparse
, random
, numpy
, and skimage
.
Running below script with the input file will generate the georeferencing information for the Area Target. Use the Python command python script.py -i path_to_input.txt
to run the script.
With the retrieved latitude and longitude, and rotation angle CCW to the North direction, you can start to Use Device Geolocation as Prior.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
|