ISP——BLC(Black Level Correction) (python重构),挑战一天一更新

import numpy as np
import matplotlib.pyplot as plt


def read_raw(file_name, bits_num, row, col):
    """
    从HiRawImage获取rawData

    参数:
        file_name (str): HiRawImage的路径
        bits_num (int): 原始图像的位数
        row (int): 原始图像的行数
        col (int): 原始图像的列数

    返回:
        np.ndarray: 原始图像数据的矩阵
    """
    # 格式精度
    if bits_num == 8:
        print('bits: 8')
        dtype = np.uint8
    elif bits_num in [10, 12, 16]:
        print(f'bits: {bits_num}')
        dtype = np.uint16
    else:
        raise ValueError("Unsupported bits_num. Only 8, 10, 12, 16 are supported.")

    # 读取文件数据
    with open(file_name, 'rb') as file:
        data = np.fromfile(file, dtype=dtype, count=row * col)

    # 处理数据
    raw_data = data.reshape((col, row)).T

    return raw_data


def show(org_data, cor_data, bits_num, mean_value):
    """
    数据可视化

    参数:
        org_data (np.ndarray): 原始图像数据
        cor_data (np.ndarray): 校正后的图像数据
        bits_num (int): 位深度
 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值