libcamera/utils/tuning/libtuning/modules/ccm/ccm.py
Paul Elder 721b976928 libtuning: modules: Add initial CCM module
Implement a minimal ccm calibration module. For now it doesn't take the
results from lsc into account and supports rkisp1 only.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-07-05 22:38:18 +02:00

41 lines
941 B
Python

# SPDX-License-Identifier: GPL-2.0-or-later
#
# Copyright (C) 2024, Paul Elder <paul.elder@ideasonboard.com>
# Copyright (C) 2024, Ideas on Board
#
# Base Ccm tuning module
from ..module import Module
from libtuning.ctt_ccm import ccm
import logging
logger = logging.getLogger(__name__)
class CCM(Module):
type = 'ccm'
hr_name = 'CCM (Base)'
out_name = 'GenericCCM'
def __init__(self, debug: list):
super().__init__()
self.debug = debug
def do_calibration(self, images):
logger.info('Starting CCM calibration')
imgs = [img for img in images if img.macbeth is not None]
# todo: Take LSC calibration results into account.
cal_cr_list = None
cal_cb_list = None
try:
ccms = ccm(imgs, cal_cr_list, cal_cb_list)
except ArithmeticError:
logger.error('CCM calibration failed')
return None
return ccms