From fb0f78e069d6d4742e90886e3424991a0286edf8 Mon Sep 17 00:00:00 2001 From: Benjamin Loison <12752145+Benjamin-Loison@users.noreply.github.com> Date: Mon, 13 May 2024 16:27:53 +0200 Subject: [PATCH] Add the ability to hardcode resolution --- datasets/raise/attribute_source_camera.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/datasets/raise/attribute_source_camera.py b/datasets/raise/attribute_source_camera.py index ad6b46e..340d6bd 100755 --- a/datasets/raise/attribute_source_camera.py +++ b/datasets/raise/attribute_source_camera.py @@ -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