Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child index out of range #4

Open
francescofugazzi opened this issue Jun 7, 2022 · 4 comments
Open

Child index out of range #4

francescofugazzi opened this issue Jun 7, 2022 · 4 comments

Comments

@francescofugazzi
Copy link

francescofugazzi commented Jun 7, 2022

I'm getting this error when running the script

File "E:\instant-ngp\instatest\scripts\agi2nerf.py", line 117, in
p2 = float(calibration[8].text)
IndexError: child index out of range

This is the first part of my camera.xml

<?xml version="1.0" encoding="UTF-8"?>
<document version="1.5.0">
  <chunk label="Chunk 1" enabled="true">
    <sensors next_id="1">
      <sensor id="0" label="unknown" type="frame">
        <resolution width="2160" height="3840"/>
        <property name="layer_index" value="0"/>
        <bands>
          <band label="Red"/>
          <band label="Green"/>
          <band label="Blue"/>
        </bands>
        <data_type>uint8</data_type>
        <calibration type="frame" class="adjusted">
          <resolution width="2160" height="3840"/>
          <f>3183.0178924306147</f>
          <cx>-3.0191925037205407</cx>
          <cy>12.686446764725096</cy>
          <k1>0.063641885377290805</k1>
          <k2>-0.071023441493781495</k2>
          <p1>-0.00066411558984484957</p1>
          <p2>0.00010212604713778139</p2>
        </calibration>
        <covariance>
          <params>f cx cy k1 k2 p1 p2</params>
          <coeffs>4.1246824410526330e-02 1.3776612207456870e-03 -4.2411697298901437e-02 3.9313934678412929e-06 5.1613719565122260e-06 3.7981705742701592e-07 -2.9472749628554441e-06 1.3776612207456870e-03 1.1165396229370850e-01 -6.6260286477075336e-04 -1.0713637960316206e-06 1.1724380451499228e-06 1.3390395933655887e-05 -3.5979429998066325e-07 -4.2411697298901437e-02 -6.6260286477075336e-04 1.5522734082239464e-01 -9.1994667509820920e-06 -2.6694619398151444e-06 -5.7232391216941584e-07 1.2638657326310680e-05 3.9313934678412929e-06 -1.0713637960316206e-06 -9.1994667509820920e-06 1.8435970633465647e-08 -3.2760959388177222e-08 -1.4119818296228413e-12 -5.1504711251021114e-10 5.1613719565122260e-06 1.1724380451499228e-06 -2.6694619398151444e-06 -3.2760959388177222e-08 7.2144288085468655e-08 -4.5890939388192768e-11 -3.3191860613579288e-10 3.7981705742701592e-07 1.3390395933655887e-05 -5.7232391216941584e-07 -1.4119818296228413e-12 -4.5890939388192768e-11 1.8001366517951657e-09 -7.3755948430424168e-11 -2.9472749628554441e-06 -3.5979429998066325e-07 1.2638657326310680e-05 -5.1504711251021114e-10 -3.3191860613579288e-10 -7.3755948430424168e-11 1.3159310546254461e-09</coeffs>
        </covariance>
      </sensor>
    </sensors>
    <components next_id="1" active_id="0">
      <component id="0" label="Component 1">
        <region>
          <center>4.2977201944667870e-01 1.7502952481358156e+00 -5.0967459918202662e+00</center>
          <size>5.7349717330932620e+01 2.9160322952270505e+01 2.2148103713989258e+01</size>
          <R>-4.2651881859495350e-01 -3.1558976947696127e-01 8.4763482395772505e-01 8.9233607291355810e-01 -2.9986785270389826e-01 3.3736568274197981e-01 1.4770927649127080e-01 9.0026794251280085e-01 4.0951141781663902e-01</R>
        </region>
        <partition>
          <camera_ids>0 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</camera_ids>
        </partition>
      </component>
    </components>
    <cameras next_id="100" next_group_id="0">
      <camera id="0" sensor_id="0" component_id="0" label="frame0000">
        <transform>6.6159962375703119e-01 -8.5504944701918273e-02 7.4496633633747211e-01 -2.1656220275301973e+01 -1.5662539868020420e-01 -9.8732166525167608e-01 2.5776225730780811e-02 -4.4206577200835371e+00 7.3331740899341891e-01 -1.3373419067754888e-01 -6.6660388831074180e-01 1.2121529258735372e+01 0 0 0 1</transform>
      </camera>
      <camera id="1" sensor_id="0" component_id="0" label="frame0001">
        <transform>6.8946094121357437e-01 -7.6902871731454520e-02 7.2022882395829457e-01 -2.0820557600907911e+01 -1.4003034579829973e-01 -9.8974074949144719e-01 2.8368134441959958e-02 -4.4201067110215693e+00 7.1065822502557530e-01 -1.2041261194560963e-01 -6.9315632442323927e-01 1.2306224779598960e+01 0 0 0 1</transform>
        <rotation_covariance>9.4240934718966737e-11 -3.3469162716744908e-11 7.2126630848199150e-11 -3.3469162716744914e-11 2.6820691786248343e-10 -2.2300135151498894e-10 7.2126630848199137e-11 -2.2300135151498889e-10 7.4342025435068256e-10</rotation_covariance>
        <location_covariance>4.3269853815255404e-06 -4.7583491511762746e-08 8.8558589241920762e-07 -4.7583491511762746e-08 3.0072993779693618e-08 2.7626120814449582e-08 8.8558589241920762e-07 2.7626120814449582e-08 2.6487925057985070e-07</location_covariance>
      </camera>

@EnricoAhlers
Copy link
Owner

Hi, sorry for the late answer. Your k3 calibration parameter is missing. It's a radial distortion coefficient for correcting the camera lens distortion. Judging by the resolution of your camera and the missing info about the camera in your XML, I'd guess that you're using digitally created images (e.g. screenshots). You might want to see if you can get that k3 info somewhere. If not, just fill it in with some value. I'm not sure about the impact of that but it's worth trying it out.

@francescofugazzi
Copy link
Author

Hi. Thanks for the answer. I managed to solve it by changing the indexes as after writing to you I noticed i was missing the k3 index. hey were frames extracted from a video.

@xrstack
Copy link

xrstack commented Jul 11, 2022

File "Z:\instant-ngp\scripts\agi2nerf.py", line 117, in <module> p1 = float(calibration[7].text) IndexError: child index out of range

Similar issue as above, except my issue is with a p1 value. I actually have all the various values generated by agisoft (though I'm posing flat video without EXIF as well) -- any idea what's up?

<calibration type="frame" class="adjusted"> <resolution width="2048" height="1152"/> <f>1451.3117496072034</f> <k1>-0.0030940813211349713</k1> <k2>-0.006699597662989859</k2> <k3>0.0082003735322349457</k3> <p1>-0.00093562244250298325</p1> <p2>0.00093194704430539033</p2> </calibration>

@senas8
Copy link

senas8 commented Oct 22, 2022

Hi im getting an error when running: instant-ngp\data\nerf\example$ python agi2nerf.py --xml_in ./example.xml
" line 5, in
import cv2
ModuleNotFoundError: No module named 'cv2'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants