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>
This commit is contained in:
parent
6672c49cbf
commit
611242b259
3 changed files with 13 additions and 5 deletions
|
@ -24,6 +24,7 @@ class Image:
|
||||||
self.lsc_only = False
|
self.lsc_only = False
|
||||||
self.color = -1
|
self.color = -1
|
||||||
self.lux = -1
|
self.lux = -1
|
||||||
|
self.macbeth = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._load_metadata_exif()
|
self._load_metadata_exif()
|
||||||
|
|
|
@ -17,12 +17,15 @@ import logging
|
||||||
from sklearn import cluster as cluster
|
from sklearn import cluster as cluster
|
||||||
|
|
||||||
from .ctt_ransac import get_square_verts, get_square_centres
|
from .ctt_ransac import get_square_verts, get_square_centres
|
||||||
|
from .image import Image
|
||||||
from libtuning.image import Image
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class MacbethError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Reshape image to fixed width without distorting returns image and scale
|
# Reshape image to fixed width without distorting returns image and scale
|
||||||
# factor
|
# factor
|
||||||
def reshape(img, width):
|
def reshape(img, width):
|
||||||
|
@ -377,7 +380,9 @@ def get_macbeth_chart(img, ref_data):
|
||||||
|
|
||||||
# Catch macbeth errors and continue with code
|
# Catch macbeth errors and continue with code
|
||||||
except MacbethError as error:
|
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)
|
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}')
|
logger.warning(f'Macbeth patches have saturated in {image.path.name}')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
image.macbeth = macbeth
|
||||||
|
|
||||||
return macbeth
|
return macbeth
|
||||||
|
|
|
@ -17,7 +17,7 @@ import logging
|
||||||
|
|
||||||
import libtuning as lt
|
import libtuning as lt
|
||||||
from libtuning.image import Image
|
from libtuning.image import Image
|
||||||
from libtuning.macbeth import locate_macbeth
|
from .macbeth import locate_macbeth
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ def load_images(input_dir: str, config: dict, load_nonlsc: bool, load_lsc: bool)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Handle macbeth
|
# Handle macbeth
|
||||||
macbeth = locate_macbeth(config)
|
macbeth = locate_macbeth(image, config)
|
||||||
if macbeth is None:
|
if macbeth is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue