<form id="dlljd"></form>
        <address id="dlljd"><address id="dlljd"><listing id="dlljd"></listing></address></address>

        <em id="dlljd"><form id="dlljd"></form></em>

          <address id="dlljd"></address>
            <noframes id="dlljd">

              聯系我們 - 廣告服務 - 聯系電話:
              您的當前位置: > 關注 > > 正文

              信息:3x3的CCM矩陣如何標定?CCM矩陣色彩校正方法

              來源:CSDN 時間:2023-03-06 08:02:33

              CCM 標定的原理是,使用 sensor 抓拍到的 24 色卡場景下前 18 個色塊的實際顏色信息和其期望值,計算 3x3 的 CCM 矩陣。輸入顏色經 CCM 矩陣處理得到的顏色與其期望值差距越小,則 CCM 矩陣就越理想。

              海思CCM矩陣:8bit 小數精度。bit 15是符號位,0 表示正數,1表示負數。典型的三組 CCM 為D50,TL84,A 三個光源下的 CCM。典型的五組 CCM為 10K,D65,D50,TL84,A 五個光源下的CCM。優先紅、綠、藍純色;然后膚色塊


              【資料圖】

              采集步驟:(1)標準 X-Rite 24 色卡,照度為 600Lux 均勻光源;(2)調整 AE 目標亮度,最亮灰階(Block 19)的 G 分量亮度在飽和值的 0.8 倍左右

              手動調試CCM步驟:

              (1)優先確認顏色問題是由于AWB模塊引入還是CCM引入

              (2)過燈箱客觀指標,確認是否需要重新標定

              (3)最后再考慮手動調整CCM

              a.一般都是針對單一顏色進行微調整(比如車牌天藍,想要深藍;人臉偏紅或是偏黃綠),所以單一顏色都會有個當前RGB值,想要調整的目標RGB值,其實調整CCM的目的就是通過CCM使得當前RGB值趨于目標RGB值

              b.針對a所述,調整RGB值,調整R:a00、a01、a02(RinR、GinR、BinR);調整G:a10、a11、a12(RinG、GinG、BinG);調整B:a20、a21、a22(RinB、GinB、BinB)。

              CCM矩陣色彩校正的方法_一只特立獨行的zhu..-CSDN博客_ccm調試

              WDR模式下標定CCM,CCM 容易受到 DRC 的影響,容易造成顏色難以矯正:

              (1)曝光比手動最大,同時也要調整亮度值,避免長幀過曝,采集長幀的 RAW 數據進行 CCM 的標定。標定過程中可以適當的降低飽和度,不能選擇開啟 autoGain 功能。

              (2)適當減少 DRC 曲線對圖像亮度的大幅度提升,這樣 DRC 對顏色的改變會較弱。此時,圖像的亮度會有所降低達不到想要的亮度,這時,可以用 gamma 對亮度進行適當的提升。這樣聯調 DRC 和 gamma 模塊,可以讓整體的顏色調節更準確一些。

              (3)對于 WDR 模式,因為大多場景是混合光源場景,容易出現亮處顏色偏色,人臉顏色偏紅等問題,除了可以降低飽和度值以外,還可以使用 CA 模塊對這些區域適當的降低飽和度。

              反gamma后圖像和gamma 1.0存在些許差異:

              (1)CSC模塊

              CCM模塊代碼:

              https://github.com/WaterdropsKun/isppipeline_Python/tree/main/lecture14

              Python實現ISP pipeline代碼:

              GitHub - WaterdropsKun/isppipeline_Python: isppipeline_Python

              如有幫助,希望幫忙github幫忙點個star

              def degamma_hisi(data, clip_range, gamma_txt):    # gamma degamma    hisi_gamma_x = 1024-1    hisi_gamma_y = 4096-1    hisi_degamma_x = 256-1    hisi_degamma_y = 1.0    gamma_hisi_x1023_y4095 = []    degamma_x255_y1 = []    with open(gamma_txt, "r") as f:        for i, line in enumerate(f.readlines()):            line = line.split(",")            gamma_hisi_x1023_y4095 = [float(x) for x in line]            # for j, value in enumerate(line):            #     print(j, value)            # x = np.arange(0, 1024+1, 1)  # np.arange(start, end+step, step)  [start, end] end/step+1            # plt.plot(x, gamma_hisi_x1023_y4095)            # plt.show()        for i in range(hisi_degamma_x+1):  # for i in range(0, hisi_degamma_x+1, 1):            for j, value in enumerate(gamma_hisi_x1023_y4095):                if (value / hisi_gamma_y * hisi_degamma_x) >= i:                    degamma_x255_y1.append(j/hisi_gamma_x)                    break        # x = np.arange(0, hisi_degamma_x+1, 1)        # plt.plot(x, degamma_x255_y1)        # plt.show()    # degamma    data = np.clip(data, clip_range[0], clip_range[1])    data = np.divide(data, clip_range[1])    height = data.shape[0]    weight = data.shape[1]    channels = data.shape[2]    for row in range(height):               # 遍歷高        for col in range(weight):           # 遍歷寬            pv0 = data[row, col, 0]            pv1 = data[row, col, 1]            pv2 = data[row, col, 2]            data[row, col, 0] = degamma_x255_y1[int(pv0*255)]            data[row, col, 1] = degamma_x255_y1[int(pv1*255)]            data[row, col, 2] = degamma_x255_y1[int(pv2*255)]    data_show = data.copy()    data_show = np.clip(data_show * clip_range[1], clip_range[0], clip_range[1])    # gbr = rgb[...,[2,0,1]]    # data_show = data_show[..., ::-1]    data_show = data_show[..., [2,1,0]]    cv2.imshow("data", data_show.astype(np.uint8))    cv2.waitKey(0)    return np.clip(data * clip_range[1], clip_range[0], clip_range[1])def gamma_hisi(data, clip_range, gamma_txt):    # gamma degamma    hisi_gamma_x = 1024-1    hisi_gamma_y = 4096-1    hisi_degamma_x = 256-1    hisi_degamma_y = 1.0    gamma_hisi_x1023_y4095 = []    degamma_x255_y1 = []    with open(gamma_txt, "r") as f:        for i, line in enumerate(f.readlines()):            line = line.split(",")            gamma_hisi_x1023_y4095 = [float(x) for x in line]            # for j, value in enumerate(line):            #     print(j, value)            # x = np.arange(0, 1024+1, 1)  # np.arange(start, end+step, step)  [start, end] end/step+1            # plt.plot(x, gamma_hisi_x1023_y4095)            # plt.show()        for i in range(hisi_degamma_x+1):  # for i in range(0, hisi_degamma_x+1, 1):            for j, value in enumerate(gamma_hisi_x1023_y4095):                if (value / hisi_gamma_y * hisi_degamma_x) >= i:                    degamma_x255_y1.append(j/hisi_gamma_x)                    break        # x = np.arange(0, hisi_degamma_x+1, 1)        # plt.plot(x, degamma_x255_y1)        # plt.show()    # gamma    data = np.clip(data, clip_range[0], clip_range[1])    data = np.divide(data, clip_range[1])    height = data.shape[0]    weight = data.shape[1]    channels = data.shape[2]    for row in range(height):               # 遍歷高        for col in range(weight):           # 遍歷寬            pv0 = data[row, col, 0]            pv1 = data[row, col, 1]            pv2 = data[row, col, 2]            data[row, col, 0] = gamma_hisi_x1023_y4095[int(pv0*1023)] / 4095.0            data[row, col, 1] = gamma_hisi_x1023_y4095[int(pv1*1023)] / 4095.0            data[row, col, 2] = gamma_hisi_x1023_y4095[int(pv2*1023)] / 4095.0    data_show = data.copy()    data_show = np.clip(data_show * clip_range[1], clip_range[0], clip_range[1])    # gbr = rgb[...,[2,0,1]]    # data_show = data_show[..., ::-1]    data_show = data_show[..., [2,1,0]]    cv2.imshow("data", data_show.astype(np.uint8))    cv2.waitKey(0)    return np.clip(data * clip_range[1], clip_range[0], clip_range[1])def CCM_convert(data, CCM, color_space="srgb", clip_range=[0, 255]):    # CCM工作在線性RGB因此需要先進行degamma    if (color_space == "srgb"):        data = color.degamma_srgb(data, clip_range)        data = np.float32(data)        data = np.divide(data, clip_range[1])  # 歸一化    elif (color_space == "hisi"):        data = degamma_hisi(data, clip_range, "./gamma_hisi_int.txt")        data = np.float32(data)        data = np.divide(data, clip_range[1])  # 歸一化    # matrix multiplication    output = np.empty(np.shape(data), dtype=np.float32)    output[:, :, 0] = data[:, :, 0] * CCM[0,0] + data[:, :, 1] * CCM[0,1] + data[:, :, 2] * CCM[0,2]    output[:, :, 1] = data[:, :, 0] * CCM[1,0] + data[:, :, 1] * CCM[1,1] + data[:, :, 2] * CCM[1,2]    output[:, :, 2] = data[:, :, 0] * CCM[2,0] + data[:, :, 1] * CCM[2,1] + data[:, :, 2] * CCM[2,2]    # gamma    if (color_space == "srgb"):        output = output*clip_range[1]        output = color.gamma_srgb(output, clip_range)    elif (color_space == "hisi"):        output = output*clip_range[1]        output = gamma_hisi(output, clip_range, "./gamma_hisi_int.txt")    return outputif __name__ == "__main__":    # CCM = np.array([    #     [1.507812, -0.546875, 0.039062],    #     [-0.226562, 1.085938, 0.140625],    #     [-0.062500, -0.648438, 1.718750],    #     ])    CCM = np.array([        [1.0, 0.0, 0.0],        [0.0, 1.0, 0.0],        [0.0, 0.0, 1.0],        ])    maxvalue = 255    # image = plt.imread("kodim19.png")    image = plt.imread("test02.png")    if (np.max(image) <= 1):        image = image * maxvalue    new_image = CCM_convert(image, CCM, color_space="hisi", clip_range=[0, maxvalue])    color.rgb_show(image / 255)    color.rgb_show(new_image / 255)

              責任編輯:

              標簽:

              相關推薦:

              精彩放送:

              新聞聚焦
              Top 中文字幕在线观看亚洲日韩