Merge pull request #1771 from alicevision/dev/LCPManagement

Add support for Lens Camera Profiles (LCP)
This commit is contained in:
Fabien Castan 2023-03-13 14:29:19 +01:00 committed by GitHub
commit fe5ecc8f8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 6 deletions

View file

@ -64,14 +64,25 @@ Intrinsic = [
desc.ChoiceParam(name="initializationMode", label="Initialization Mode", desc.ChoiceParam(name="initializationMode", label="Initialization Mode",
description="Defines how this Intrinsic was initialized:\n" description="Defines how this Intrinsic was initialized:\n"
" * calibrated: calibrated externally.\n" " * calibrated: calibrated externally.\n"
" * estimated: estimated from metadata and/or sensor width. \n" " * estimated: estimated from metadata and/or sensor width \n"
" * unknown: unknown camera parameters (can still have default value guess)\n"
" * none: not set",
values=("calibrated", "estimated", "unknown", "none"),
value="none",
exclusive=True,
uid=[0],
),
desc.ChoiceParam(name="distortionInitializationMode", label="Distortion Initialization Mode",
description="Defines how the distortion model and parameters was initialized:\n"
" * calibrated: calibrated externally.\n"
" * estimated: estimated from a database of generic calibration \n"
" * unknown: unknown camera parameters (can still have default value guess)\n" " * unknown: unknown camera parameters (can still have default value guess)\n"
" * none: not set", " * none: not set",
values=("calibrated", "estimated", "unknown", "none"), values=("calibrated", "estimated", "unknown", "none"),
value="none", value="none",
exclusive=True, exclusive=True,
uid=[0], uid=[0],
advanced=True
), ),
desc.ListAttribute( desc.ListAttribute(
@ -80,6 +91,7 @@ Intrinsic = [
label="Distortion Params", label="Distortion Params",
description="Distortion Parameters", description="Distortion Parameters",
), ),
desc.BoolParam(name='locked', label='Locked', desc.BoolParam(name='locked', label='Locked',
description='If the camera has been calibrated, the internal camera parameters (intrinsics) can be locked. It should improve robustness and speedup the reconstruction.', description='If the camera has been calibrated, the internal camera parameters (intrinsics) can be locked. It should improve robustness and speedup the reconstruction.',
value=False, uid=[0]), value=False, uid=[0]),
@ -162,14 +174,28 @@ The metadata needed are:
value='${ALICEVISION_SENSOR_DB}', value='${ALICEVISION_SENSOR_DB}',
uid=[], uid=[],
), ),
desc.File(
name='lensCorrectionProfileInfo',
label='Lens Correction Profile Info',
description='''Lens Correction Profile filepath or database directory.''',
value='${ALICEVISION_LENS_PROFILE_INFO}',
uid=[],
),
desc.BoolParam(
name='lensCorrectionProfileSearchIgnoreCameraModel',
label='LCP Generic Search',
description='The lens name and camera maker are used to match the LCP database, but the camera model is ignored.',
value=True,
uid=[0],
advanced=True,
),
desc.FloatParam( desc.FloatParam(
name='defaultFieldOfView', name='defaultFieldOfView',
label='Default Field Of View', label='Default Field Of View',
description='Empirical value for the field of view in degree.', description='Default value for the field of view (in degree) used as an initialization when there is no focal or field of view in the image metadata.',
value=45.0, value=45.0,
range=(0.0, 180.0, 1.0), range=(0.0, 180.0, 1.0),
uid=[], uid=[],
advanced=True,
), ),
desc.ChoiceParam( desc.ChoiceParam(
name='groupCameraFallback', name='groupCameraFallback',
@ -184,7 +210,6 @@ The metadata needed are:
value='folder', value='folder',
exclusive=True, exclusive=True,
uid=[], uid=[],
advanced=True,
), ),
desc.ChoiceParam( desc.ChoiceParam(
name='allowedCameraModels', name='allowedCameraModels',
@ -205,7 +230,7 @@ The metadata needed are:
'LibRawNoWhiteBalancing: Simple neutralization.\n' 'LibRawNoWhiteBalancing: Simple neutralization.\n'
'LibRawWhiteBalancing: Use internal white balancing from libraw.\n' 'LibRawWhiteBalancing: Use internal white balancing from libraw.\n'
'DCPLinearProcessing: Use DCP color profile.\n' 'DCPLinearProcessing: Use DCP color profile.\n'
'DCPMetadata: Same as None with DCP info added in metadata.\n', 'DCPMetadata: Same as None with DCP info added in metadata.',
value='DCPLinearProcessing' if os.environ.get('ALICEVISION_COLOR_PROFILE_DB', '') else 'LibRawWhiteBalancing', value='DCPLinearProcessing' if os.environ.get('ALICEVISION_COLOR_PROFILE_DB', '') else 'LibRawWhiteBalancing',
values=['None', 'LibRawNoWhiteBalancing', 'LibRawWhiteBalancing', 'DCPLinearProcessing'], values=['None', 'LibRawNoWhiteBalancing', 'LibRawWhiteBalancing', 'DCPLinearProcessing'],
exclusive=True, exclusive=True,

View file

@ -108,6 +108,31 @@ Convert or apply filtering to the input images.
value=False, value=False,
uid=[0], uid=[0],
), ),
desc.GroupAttribute(name="lensCorrection", label="Lens Correction", description="Automatic lens correction settings.", joinChar=":", groupDesc=[
desc.BoolParam(
name='lensCorrectionEnabled',
label='Enable',
description='Enable lens correction.',
value=False,
uid=[0],
),
desc.BoolParam(
name='geometry',
label='Geometry',
description='Geometry correction if a model is available in sfm data.',
value=False,
uid=[0],
enabled=lambda node: node.lensCorrection.lensCorrectionEnabled.value,
),
desc.BoolParam(
name='vignetting',
label='Vignetting',
description='Vignetting correction if model parameters are available in metadata.',
value=False,
uid=[0],
enabled=lambda node: node.lensCorrection.lensCorrectionEnabled.value,
),
]),
desc.FloatParam( desc.FloatParam(
name='scaleFactor', name='scaleFactor',
label='ScaleFactor', label='ScaleFactor',

View file

@ -15,6 +15,7 @@ ImageBadge {
property var intrinsic: null property var intrinsic: null
readonly property string intrinsicInitMode: intrinsic ? childAttributeValue(intrinsic, "initializationMode", "none") : "unknown" readonly property string intrinsicInitMode: intrinsic ? childAttributeValue(intrinsic, "initializationMode", "none") : "unknown"
readonly property string distortionInitMode: intrinsic ? childAttributeValue(intrinsic, "distortionInitializationMode", "none") : "unknown"
readonly property string distortionModel: intrinsic ? childAttributeValue(intrinsic, "type", "") : "" readonly property string distortionModel: intrinsic ? childAttributeValue(intrinsic, "type", "") : ""
property var metadata: ({}) property var metadata: ({})
@ -55,6 +56,8 @@ ImageBadge {
ToolTip.text: "<b>Camera Intrinsics: " + statusText + "</b><br>" ToolTip.text: "<b>Camera Intrinsics: " + statusText + "</b><br>"
+ (detailsText ? detailsText + "<br>" : "") + (detailsText ? detailsText + "<br>" : "")
+ (helperText ? helperText + "<br>" : "") + (helperText ? helperText + "<br>" : "")
+ "<br>"
+ "<b>Distortion: " + distortionInitMode + "</b><br>"
+ (distortionModel ? 'Distortion Model: ' + distortionModel + "<br>" : "") + (distortionModel ? 'Distortion Model: ' + distortionModel + "<br>" : "")
+ "<br>" + "<br>"
+ "[Metadata]<br>" + "[Metadata]<br>"