Forum

Author Topic: chunk.exportOrthophoto is throwing 'list index out of range'  (Read 6210 times)

nickponline

  • Newbie
  • *
  • Posts: 38
    • View Profile
chunk.exportOrthophoto is throwing 'list index out of range'
« on: September 04, 2014, 02:08:36 AM »
Trying to stitch these 9 images using a python scripts and chunk.exportOrthophoto is throwing 'list index out of range'

https://www.dropbox.com/s/lcvsb3fuhi67rsh/Archive.zip?dl=0


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: chunk.exportOrthophoto is throwing 'list index out of range'
« Reply #1 on: September 04, 2014, 11:16:36 AM »
Hello nickponline,

Maybe you can post a code lines PhotoScan is referring to in the Console pane? Or the full script, if it is not very long.
Best regards,
Alexey Pasumansky,
Agisoft LLC

nickponline

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: chunk.exportOrthophoto is throwing 'list index out of range'
« Reply #2 on: September 05, 2014, 02:47:29 AM »
Here's some of the code, it's the same code I am running on other jobs which work. Which makes me think it's something to do with the images, although I'm not sure what is wrong with them. They have EXIF data.

chunk.matchPhotos(accuracy='high', preselection='ground control')
chunk.matchPhotos(accuracy='high', preselection='disabled')  # vertical reconstruction
chunk.alignPhotos()
chunk.buildPoints(error=1)
chunk.optimizePhotos()
chunk.buildDenseCloud(quality='high')
chunk.buildModel(surface='height field', source='dense', faces='high')
chunk.model.fixTopology()
chunk.buildPoints(error=1)
chunk.buildTexture(blending='mosaic')
chunk.exportReport(report_path)
chunk.exportOrthophoto(preview_path, dx=0.000005, dy=0.000005, color_correction=False, blending='mosaic', write_kml=True, write_world=True, projection=chunk.projection)
chunk.exportOrthophoto(orthophoto_path, blockw=blockw, blockh=blockh, color_correction=False, blending='mosaic', write_kml=True, write_world=True, projection=chunk.projection)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: chunk.exportOrthophoto is throwing 'list index out of range'
« Reply #3 on: September 05, 2014, 12:59:31 PM »
Hello nickponline,

And what is the full error message (written in red color) in the Console pane?

Also I doubt that using .buildPoints function after the model generation will have any effect on the resulting orthophoto.
Best regards,
Alexey Pasumansky,
Agisoft LLC

nickponline

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: chunk.exportOrthophoto is throwing 'list index out of range'
« Reply #4 on: September 05, 2014, 08:36:16 PM »
The 'list index error' is in my code which runs after the script I posted above, but sometimes AgiSoft succeeds and sometimes is fails (that's when the exception is thrown) with these 9 images. If it succeeds the console output is:

OpenGL Vendor: Intel Inc.
OpenGL Renderer: Intel Iris OpenGL Engine
OpenGL Version: 2.1 INTEL-8.28.30
Maximum Texture Size: 16384
Quad Buffered Stereo: not enabled
ARB_vertex_buffer_object: supported
ARB_texture_non_power_of_two: supported
bbox_center:
bbox_size:
bbox_rot:
Loading camera = /images/gopr0159.jpg
Loading camera = /images/gopr0160.jpg
Loading camera = /images/gopr0161.jpg
Loading camera = /images/gopr0162.jpg
Loading camera = /images/gopr0163.jpg
Loading camera = /images/gopr0164.jpg
Loading camera = /images/gopr0165.jpg
Loading camera = /images/gopr0166.jpg
Loading camera = /images/gopr0167.jpg
Analyzing photos...
analyzing photos... ********* finished in 4.24652 sec
Finished processing in 4.24657 sec (exit code 1)
Detecting points...
photo 1: 18532 points
photo 2: 30078 points
photo 3: 33757 points
photo 4: 34292 points
photo 5: 32039 points
photo 6: 30710 points
photo 7: 38431 points
photo 8: 36842 points
photo 9: 31356 points
points detected in 13.4297 sec
Selecting pairs...
710 matches found in 0.956407 sec
7 of 36 pairs selected in 0.000291 sec
Matching points...
2359 matches found in 6.50647 sec
setting point indices... 1613 done in 0.000675 sec
removed 12 multiple projections
removed 2 points
generated 1611 tie points, 2.0807 average projections
finished matching in 20.8958 sec
Finished processing in 20.9067 sec (exit code 1)
Estimating scene structure...
group size: 9 photos
pair 3 and 5: 422 robust from 761
adding photos 3 and 5 (422 robust)
adding 429 points, 6 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 1.68472 -> 1.56788
adding 9 points, 3 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 1.60642 -> 1.45246
adding 26 points, 7 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 1.6589 -> 0.98878
adding 144 points, 8 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 1.79191 -> 0.953461
adding 38 points, 1 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 1.18655 -> 1.05931
adding 3 points, 1 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
optimized in 0.081333 seconds
adding photo 2 (3 of 9), 5 of 6 used
adding 53 points, 1 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 1.1312 -> 1.10123
adding 2 points, 2 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
optimized in 0.025386 seconds
3 sigma filtering...
bundle_adjust: xxxxxxxxxxxxxxxxxxxx 1.09148 -> 0.866281
point variance: 0.865962
adding 10 points, 13 far (2.59789 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxxxxxxx 0.756286 -> 0.72208
point variance: 0.721813
adding 3 points, 12 far (2.16544 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxxxxxxxxx 0.653391 -> 0.645924
point variance: 0.645681
adding 1 points, 6 far (1.93704 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxxxxxxxxxxx 0.625472 -> 0.617914
point variance: 0.61768
adding 1 points, 4 far (1.85304 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxxxxxxx 0.606619 -> 0.604789
point variance: 0.604559
adding 1 points, 2 far (1.81368 threshold), 0 inaccurate, 0 invisible, 0 weak
optimized in 0.169152 seconds
fx 1797.22, fy 1797.22, cx 1659.8, cy 1146.13, k1 -0.326667, k2 0.152305, k3 -0.0325879
finished sfm in 0.313141 seconds
Finished processing in 0.313252 sec (exit code 1)
adding 566 points, 22 far (1 threshold), 0 inaccurate, 0 invisible, 0 weak
Finished processing in 0.002057 sec (exit code 1)
Optimizing point cloud...
weights: 10.8071 cameras, 21614.1 markers, 108071 scalebars, 40 projections
bundle_adjust: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0.477244 -> 0.422242
finished SBA in 0.070087 seconds
Finished processing in 0.070219 sec (exit code 1)
initializing...
selected 2 cameras from 3 in 0.000432 sec
Loading photos...
Reconstructing depth...
[CPU] estimating 1334x917x160 disparity using 1334x917x8u tiles, offset 0
timings: rectify: 0.119451 disparity: 2.7479 borders: 0.02747 filter: 0.044983 fill: 0
[CPU] estimating 1159x925x160 disparity using 1159x925x8u tiles, offset 0
timings: rectify: 0.106111 disparity: 2.44525 borders: 0.027041 filter: 0.043752 fill: 0
finished depth reconstruction in 6.06512 seconds
Device 1 performance: 72.5805 million samples/sec (CPU)
Total performance: 72.5805 million samples/sec
Generating dense point cloud...
selected 2 cameras in 0.068885 sec
working volume: 3803x3464x360
tiles: 1x1x1
selected 2 cameras
preloading data... done in 0.155779 sec
filtering depth maps... done in 0.358866 sec
accumulating data... done in 0.846893 sec
accumulator: 65.4484 MB
octree constructed in 0.094997 sec
nodes: 548 (0.026304 MB)
points: 927400 (9.274 MB)
nodes: 548 (0.026304 MB)
points: 927400 (9.274 MB)
927400 points extracted
Finished processing in 8.12272 sec (exit code 1)
Generating mesh...
generating 3803x3464 grid (0.00111815 resolution)
grid rasterized in 0.019151 sec
filtering median... done in 0.105931 sec
filtering idw... done in 0.216452 sec
filtering median... done in 0.091136 sec
constructed triangulation from 17083 vertices, 34160 faces
grid interpolated in 20.8134 sec
filtered borders in 0.254407 sec
triangulating... 92740 points 185298 faces done in 3.32191 sec
Calculating vertex colors...
processing nodes...  done in 0.003611 sec
calculating colors...  done in 0.476173 sec
Finished processing in 24.9304 sec (exit code 1)
floating faces detected - fixed
Finished processing in 0.072786 sec (exit code 1)
total 2 faces removed
adding 561 points, 31 far (1 threshold), 0 inaccurate, 0 invisible, 530 weak
Finished processing in 0.003153 sec (exit code 1)
Parameterizing texture atlas...
heap cleanup: 277196 -> 235662
heap cleanup: 277196 -> 211470
heap cleanup: 277197 -> 171452
Packing 105 charts...
Blending textures...
blending textures... *** done in 2.13589 sec
postprocessing atlas... done in 0.045833 sec
Finished processing in 51.6012 sec (exit code 1)
Generating report...
Finished processing in 1.85058 sec (exit code 1)
initializing renderer... tessellating mesh...done (167423 -> 167645 faces)
done in 0.038305 sec
Raster size: 149x77
Estimating mosaic occupancy...
1 blocks used from 1x1 (100%)
Rendering mosaic...
selected 3 cameras, 167645 faces
blending 3 images... *** done in 0.830343 sec
writing block... done in 0.010248 sec
Finished processing in 0.918637 sec (exit code 1)
initializing renderer... tessellating mesh...done (167423 -> 167645 faces)
done in 0.035799 sec
Raster size: 4335x2829
Estimating mosaic occupancy...
2 blocks used from 2x1 (100%)
Rendering mosaic...
selected 3 cameras, 167645 faces
blending 3 images... *** done in 2.90354 sec
writing block... done in 0.749336 sec
selected 2 cameras, 167645 faces
blending 2 images... ** done in 0.683758 sec
writing block... done in 0.348189 sec
Finished processing in 6.68803 sec (exit code 1)
initializing renderer... tessellating mesh...done (167423 -> 167645 faces)
done in 0.038133 sec
Raster size: 4335x2829
Estimating mosaic occupancy...
2 blocks used from 2x1 (100%)
Rendering mosaic...
selected 167645 faces
writing block... done in 0.897472 sec
selected 60577 faces
writing block... done in 0.49772 sec
Finished processing in 3.51706 sec (exit code 1)
Saving project...
saved project in 1.39467 sec
Finished processing in 1.3948 sec (exit code 1)
Decimating mesh...
Finished processing in 1.8e-05 sec (exit code 1)
Parameterizing texture atlas...
heap cleanup: 277196 -> 235662
heap cleanup: 277196 -> 211470
heap cleanup: 277197 -> 171452
Packing 105 charts...
Blending textures...
blending textures... *** done in 2.07277 sec
postprocessing atlas... done in 0.06666 sec
Finished processing in 56.081 sec (exit code 1)
Saving 3D model...
Finished processing in 1.05876 sec (exit code 1)
>>>

Where as if it fails I get

OpenGL Vendor: Intel Inc.
OpenGL Renderer: Intel Iris OpenGL Engine
OpenGL Version: 2.1 INTEL-8.28.30
Maximum Texture Size: 16384
Quad Buffered Stereo: not enabled
ARB_vertex_buffer_object: supported
ARB_texture_non_power_of_two: supported
bbox_center:
bbox_size:
bbox_rot:
Loading camera = /images/gopr0159.jpg
Loading camera = /images/gopr0160.jpg
Loading camera = /images/gopr0161.jpg
Loading camera = /images/gopr0162.jpg
Loading camera = /images/gopr0163.jpg
Loading camera = /images/gopr0164.jpg
Loading camera = /images/gopr0165.jpg
Loading camera = /images/gopr0166.jpg
Loading camera = /images/gopr0167.jpg
Analyzing photos...
analyzing photos... ********* finished in 4.39484 sec
Finished processing in 4.39489 sec (exit code 1)
Detecting points...
photo 1: 18532 points
photo 2: 30078 points
photo 3: 33757 points
photo 4: 34292 points
photo 5: 32039 points
photo 6: 30710 points
photo 7: 38431 points
photo 8: 36842 points
photo 9: 31356 points
points detected in 14.9459 sec
Selecting pairs...
710 matches found in 1.06483 sec
8 of 36 pairs selected in 0.000308 sec
Matching points...
2542 matches found in 7.8303 sec
setting point indices... 1761 done in 0.000652 sec
removed 12 multiple projections
removed 1 points
generated 1760 tie points, 2.0733 average projections
finished matching in 23.8444 sec
Finished processing in 23.8563 sec (exit code 1)
Estimating scene structure...
group size: 9 photos
pair 3 and 5: 410 robust from 764
adding photos 3 and 5 (410 robust)
adding 427 points, 13 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 2.28581 -> 2.06123
adding 53 points, 6 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 2.39688 -> 2.26079
adding 20 points, 3 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 2.39403 -> 2.33578
adding 25 points, 3 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 2.46242 -> 2.20674
adding 17 points, 2 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 2.26642 -> 1.37812
adding 4 points, 1 far (5.25 threshold), 0 inaccurate, 0 invisible, 0 weak
optimized in 0.099437 seconds
adding photo 2 (3 of 9), 6 of 7 used
adding 64 points, 1 far (5.25 threshold), 0 inaccurate, 1 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 1.42198 -> 1.35765
adding 4 points, 3 far (5.25 threshold), 0 inaccurate, 1 invisible, 0 weak
optimized in 0.017067 seconds
3 sigma filtering...
bundle_adjust: xxxxxxxxxxxxxxxxxxxx 1.32085 -> 0.958196
point variance: 0.957785
adding 2 points, 15 far (2.87336 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxxxxxxxx 0.786518 -> 0.76037
point variance: 0.760036
adding 0 points, 9 far (2.28011 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxxx 0.702642 -> 0.700693
point variance: 0.70038
adding 0 points, 5 far (2.10114 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxx 0.675731 -> 0.675371
point variance: 0.675067
adding 2 points, 4 far (2.0252 threshold), 0 inaccurate, 0 invisible, 0 weak
bundle_adjust: xxxxxxxxxxxx 0.66646 -> 0.66598
point variance: 0.665679
adding 2 points, 2 far (1.99704 threshold), 0 inaccurate, 0 invisible, 0 weak
optimized in 0.223633 seconds
fx 1169.59, fy 1169.59, cx 1731.51, cy 1177.09, k1 -0.144618, k2 0.0267, k3 -0.00209453
finished sfm in 0.380667 seconds
Finished processing in 0.380795 sec (exit code 1)
adding 432 points, 29 far (1 threshold), 0 inaccurate, 0 invisible, 403 weak
Finished processing in 0.001953 sec (exit code 1)
Optimizing point cloud...
weights: 8.86352 cameras, 17727 markers, 88635.2 scalebars, 40 projections
not enough data for optimization
finished SBA in 5e-06 seconds
Finished processing in 8.6e-05 sec (exit code 1)
initializing...
selected 0 cameras from 0 in 0.00012 sec
Loading photos...
Reconstructing depth...
finished depth reconstruction in 6.4e-05 seconds
Device 1 performance: 0 million samples/sec (CPU)
Generating dense point cloud...
selected 0 cameras in 3.8e-05 sec
Finished processing in 0.000535 sec (exit code 0)
Generating mesh...
Finished processing in 4.8e-05 sec (exit code 0)
adding 0 points, 0 far (1 threshold), 0 inaccurate, 0 invisible, 0 weak
Finished processing in 0.000755 sec (exit code 1)
Finished processing in 8e-06 sec (exit code 0)
False
Generating report...
Finished processing in 3e-05 sec (exit code 0)
initializing renderer... done in 1.8e-05 sec
Error: can't estimate export region
Finished processing in 8.4e-05 sec (exit code 0)
False
False
initializing renderer... done in 2.3e-05 sec
Error: can't estimate export region
Finished processing in 7.1e-05 sec (exit code 0)
Saving project...
saved project in 0.012477 sec
Finished processing in 0.012591 sec (exit code 1)
Decimating mesh...
Finished processing in 1.9e-05 sec (exit code 0)
Finished processing in 2e-06 sec (exit code 0)
Finished processing in 6e-06 sec (exit code 0)
>>>

How do I know what is causing it to sometimes pass and sometimes fail. Is there a step that is not deterministic, like RANSAC? If so is there any way to change the parameters, I'm less concerned if it's slow but really want to to succeed whenever possible.