Closed emmcb closed 1 month ago
Hello , I pushed a v0.0.10 : https://pypi.org/project/cxx-image-io/0.0.10/
{'fileInfo': {'width': 4080, 'height': 3072, 'pixelPrecision': 12, 'fileFormat': 'raw12', 'imageLayout': 'planar', 'pixelType': 'bayer_gbrg', 'pixelRepresentation': 'uint16'}, 'exifMetadata': {'imageWidth': 4080, 'imageHeight': 3072, 'imageDescription': 'Raw 12 bit image', 'make': 'Xiaomi', 'model': 'M2102K1G', 'orientation': 1, 'software': 'Impact', 'exposureTime': [1, 60], 'fNumber': [195, 100], 'isoSpeedRatings': 50, 'dateTimeOriginal': '2021:11:16 13:15:20', 'brightnessValue': [0, 100], 'exposureBiasValue': [0, 6], 'focalLength': [7590, 1000], 'focalLengthIn35mmFilm': 7}, 'shootingParams': {'aperture': 2.200000047683716, 'exposureTime': 0.01663152687251568, 'sensitivity': 1.2000000476837158, 'totalGain': 1.0010349750518799, 'sensorGain': 1.0, 'ispGain': 1.0010349750518799, 'zoom': [0.05000000074505806, 0.10000000149011612, 0.8999999761581421, 0.800000011920929]}, 'cameraControls': {'whiteBalance': [2.2234599590301514, 1.4621033668518066], 'colorShading': [[[2.0, 1.5, 2.0], [1.5, 1.0, 1.5], [2.0, 1.5, 2.0]], [[3.0, 2.5, 3.0], [2.5, 1.0, 2.5], [3.0, 2.5, 3.0]]], 'faceDetection': [[0.0, 0.0, 100.0, 200.0], [0.0, 0.0, 120.0, 180.0]]}, 'calibrationData': {'blackLevel': 256, 'whiteLevel': 4095.0, 'vignetting': [[2.0, 1.5, 2.0], [1.5, 1.100000023841858, 1.5], [2.0, 1.5, 2.0]], 'colorMatrix': [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0], [1.0, 1.0, 1.0]], 'colorMatrixTarget': 'srgb'}, 'semanticMasks': []}
__dict__,
so I need to create a serialize() method explicitly )
import json
with open('metadata.json', 'w') as fp:
json.dump(metadata.serialize(), fp)
You can also print or dump the sub part like print(metadata.exifMetdata) .
Hello, thank you for the new version. I can print the fileInfo, exifMetadata, shootingParams, and calibrationData, but on my test image i cannot print cameraControls nor the whole metadata:
print(metadata.fileInfo)
print(metadata.exifMetadata)
print(metadata.shootingParams)
# print(metadata.cameraControls) KO
print(metadata.calibrationData)
# print(metadata) KO
Here are the error messages:
print(metadata.cameraControls)
TypeError: __repr__(): incompatible function arguments. The following argument types are supported:
1. (self: cxx_image.ImageMetadata.ShootingParams) -> str
Invoked with: <repr raised Error>
print(metadata)
AttributeError: 'NoneType' object has no attribute 'serialize'
Can you give me your metadata json file for my testing? Because my metadata example works , I think it might be some case I cannot produce easily.
new verion v0.0.11 is uploaded: https://pypi.org/project/cxx-image-io/0.0.11/
it should work in this version, it was because of typo in the code, cameraControls
was mis-typed as ShootingParams
, that was why we had "argument types are supported" , sorry for that .
Thanks, it works fine using version 0.0.11!
Currently a
print(metadata)
only outputs:Thus it is very hard to debug what are the actual metadata values we get when reading an image.
It should be nice that the ImageMetadata binding implements the python
__repr__
method, so that when printing it we get a meaningful output.