Add the ability to hardcode resolution

This commit is contained in:
Benjamin Loison 2024-05-13 16:27:53 +02:00
parent 86093a40c0
commit fb0f78e069
No known key found for this signature in database

View File

@ -32,7 +32,7 @@ for camera in IMAGES_CAMERAS_FOLDER:
random.shuffle(imagesCamerasFileNames[camera])
# Limit number of images per camera with the one having the less images.
minimumNumberOfImagesCameras = 4#min([len(imagesCamerasFileNames[camera]) for camera in IMAGES_CAMERAS_FOLDER])
minimumNumberOfImagesCameras = min([len(imagesCamerasFileNames[camera]) for camera in IMAGES_CAMERAS_FOLDER])
for camera in IMAGES_CAMERAS_FOLDER:
imagesCamerasFileNames[camera] = imagesCamerasFileNames[camera][:minimumNumberOfImagesCameras]
print(camera, imagesCamerasFileNames[camera])
@ -43,13 +43,14 @@ camerasIterativeMean = {camera: iterativeMean() for camera in IMAGES_CAMERAS_FOL
# Compute the minimal color channel camera resolution.
# Assume that for each camera, its images have the same resolution.
# The following consider a given color channel resolution, assuming they all have the same resolution.
minimalColorChannelCameraResolution = None
for camera in IMAGES_CAMERAS_FOLDER:
imageFileName = imagesCamerasFileNames[camera][0]
imageFilePath = f'{IMAGES_CAMERAS_FOLDER[camera]}/{imageFileName}'
singleColorChannelImagesShape = getColorChannel(imageFilePath, Color.RED).shape
if minimalColorChannelCameraResolution is None or singleColorChannelImagesShape < minimalColorChannelCameraResolution:
minimalColorChannelCameraResolution = singleColorChannelImagesShape
minimalColorChannelCameraResolution = (100, 100)#None
if minimalColorChannelCameraResolution is None:
for camera in IMAGES_CAMERAS_FOLDER:
imageFileName = imagesCamerasFileNames[camera][0]
imageFilePath = f'{IMAGES_CAMERAS_FOLDER[camera]}/{imageFileName}'
singleColorChannelImagesShape = getColorChannel(imageFilePath, Color.RED).shape
if minimalColorChannelCameraResolution is None or singleColorChannelImagesShape < minimalColorChannelCameraResolution:
minimalColorChannelCameraResolution = singleColorChannelImagesShape
minColor = 0#None
maxColor = 7952#None