rennu / dpg

OpenMVG + OpenMVS Pipeline
82 stars 28 forks source link

Missing type at icmodel argument #16

Closed nujust closed 3 years ago

nujust commented 3 years ago

Hello.

There is missing type at icmodel argument.

line 84-86 in pipeline.py

    incrementalSfm.add_argument('--icmodel',
        help='The camera model type that will be used for views with unknown intrinsic: 1. Pinhole 2. Pinhole radial 1 3. Pinhole radial 3 (default) 4. Pinhole radial 3 + tangential 2 5. Pinhole fisheye',
        choices=[1, 2, 3, 4, 5])

Is the following correct?

    incrementalSfm.add_argument('--icmodel',
        type=int,
        help='The camera model type that will be used for views with unknown intrinsic: 1. Pinhole 2. Pinhole radial 1 3. Pinhole radial 3 (default) 4. Pinhole radial 3 + tangential 2 5. Pinhole fisheye',
        choices=[1, 2, 3, 4, 5])

Thank you.

rennu commented 3 years ago

Hi,

Thanks for noticing. There were some other arguments that were missing types too. I've added them now (although I'm not sure if they are actually needed since choices defines allowed values).

nujust commented 3 years ago

Hi, Thank you for your great job.

It seems that the types of the type and choice arguments must match.

I noticed this problem when I ran pipeline.py with the argument --icmodel 5. I faced this error:

pipeline.py: error: argument --icmodel: invalid choice: '5' (choose from 1, 2, 3, 4, 5)

In this case, 5 is entered as a string. Because choice are int, the types did not match.

This is discripted here: https://docs.python.org/3/library/argparse.html#choices

Note that inclusion in the choices container is checked after any type conversions have been performed, so the type of the objects in the choices container should match the type specified