# SPDX-License-Identifier: BSD-2-Clause## Copyright (C) 2019-2020, Raspberry Pi (Trading) Limited## ctt_image_load.py - camera tuning tool image loadingfrom ctt_tools import*from ctt_macbeth_locator import*import json
import pyexiv2 as pyexif
import rawpy as raw
"""Image class load image from raw data and extracts metadata.Once image is extracted from data, it finds 24 16x16 patches for eachchannel, centred at the macbeth chart squares"""class Image:def__init__(self, buf):
self.buf = buf
self.patches =None
self.saturated =False''' obtain metadata from buffer '''defget_meta(self):
self.ver =ba_to_b(self.buf[4:5])