diff options
author | Stefan Klug <stefan.klug@ideasonboard.com> | 2024-06-11 09:41:00 +0200 |
---|---|---|
committer | Stefan Klug <stefan.klug@ideasonboard.com> | 2024-07-05 22:38:16 +0200 |
commit | 611242b259b0450755e7d8cddba0c8026fc20c7f (patch) | |
tree | 12ffeca96a416f56e4ab500ec603448c8c98e2ae /utils/tuning/libtuning/macbeth.py | |
parent | 6672c49cbfc3de5e59b3176ec4e72df7c843d193 (diff) |
libtuning: Reactivate macbeth locator
Add the missing pieces and store the result inside the image object.
This solution is not very nice, and should be refactored soon. For that
we need a concept to collect temperature and/or image specific results
in a central place. For now it serves the purpose.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'utils/tuning/libtuning/macbeth.py')
-rw-r--r-- | utils/tuning/libtuning/macbeth.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/utils/tuning/libtuning/macbeth.py b/utils/tuning/libtuning/macbeth.py index 28051de8..4a2006b0 100644 --- a/utils/tuning/libtuning/macbeth.py +++ b/utils/tuning/libtuning/macbeth.py @@ -17,12 +17,15 @@ import logging from sklearn import cluster as cluster from .ctt_ransac import get_square_verts, get_square_centres - -from libtuning.image import Image +from .image import Image logger = logging.getLogger(__name__) +class MacbethError(Exception): + pass + + # Reshape image to fixed width without distorting returns image and scale # factor def reshape(img, width): @@ -377,7 +380,9 @@ def get_macbeth_chart(img, ref_data): # Catch macbeth errors and continue with code except MacbethError as error: - logger.warning(error) + # \todo: This happens so many times in a normal run, that it shadows + # all the relevant output + # logger.warning(error) return (0, None, None, False) @@ -527,4 +532,6 @@ def locate_macbeth(image: Image, config: dict): logger.warning(f'Macbeth patches have saturated in {image.path.name}') return None + image.macbeth = macbeth + return macbeth |