Tone curve table

本文介绍了一种基于Asymmetry和SecondPole参数的音视频处理中色调曲线映射方法。通过数学公式计算出不同的输入输出值,实现对图像或视频色调的调整。该方法适用于多种音视频编辑软件。

function lut = Tone_curve_table(Asymmetry, SecondPole)
%%plot(Tone_curve_table(5, 100))
%hold on
%plot(Tone_curve_table(25, 200))
%Asymmetry:[1:255], SecondPole:[1:255]

x = (Asymmetry + 1)/257*2-1;
ai = floor(0.5 + 255*(1-1/(1000*x*x*x)) + x - ((x>=0).*2));
ii = (0:32)';

if ai >=0
    x = ii /32;
else
    x = (32 - ii) / 32;
end

as = abs(ai ./ 255);
dp = SecondPole ./ 255;
y = round((dp + (1-dp).*((abs(1-dp-x)./dp).^3)).*(x.*(as+1)./(as+x)).*65535);
y = max(0,min(y, 65535));
if ai < 0
    y = 65535 - y;
end
lut = round(y);

struct BayerGridInfoSum 93 { 94 UINT32 BGSum[STATS_BAYER_CH_MAX][DefaultBayerGridsMaxNum]; // Gray sum of normal pixels 95 UINT16 BGCount[STATS_BAYER_CH_MAX][DefaultBayerGridsMaxNum]; // Sum of normal pixels 96 UINT32 SatBGSum[STATS_BAYER_CH_MAX][DefaultBayerGridsMaxNum]; // Gray sum of saturated pixels 97 UINT16 SatBGCount[STATS_BAYER_CH_MAX][DefaultBayerGridsMaxNum]; // Sum of saturated pixels 98 }; 99 100 #ifdef OPLUS_FEATURE_CAMERA_COMMON 101 struct AECCoreFrameControl_OEM 102 { 103 FLOAT faceLumaRatio; ///< face / frame Luma Ratio 104 BOOL isNeedFaceToneSmoothing; ///< Whether need face tone smoothing process 105 FLOAT hdrBrightenEVMultiplier; ///< capture hdr brighten ev Multiplier 106 BOOL toneTriggeredByZoomRatioEn; ///< tmc/ltm/gamma triggered by zoom ratio 107 StatisticsAntibanding aecFlikcerCompMode; 108 }; 109 110 struct AECCoreFrameInfo_OEM 111 { 112 //pangfeilong@Camera , 2020/01/18 , add for DXO test: checker board chart and flat scene case 113 BOOL acutance_hist_detected; 114 INT32 autoHDRDetected; ///< AutoHDR Detected 115 INT32 CHDRDetected; ///< CHDR Detected 116 FLOAT hdrEVPlus; ///< Auto HDR EVPlus 117 FLOAT hdrEVMinus; ///< Auto HDR EVMinus 118 FLOAT hdrEV0; ///< Auto HDR EV0 119 FLOAT nightEVPlusHand; ///< Auto Night EVPlus Hand 120 FLOAT nightEVPlusTripod; ///< Auto Night EVPlus Tripod 121 FLOAT nightEVMinus; ///< Auto Night EVMinus 122 FLOAT nightEV0; ///< Auto Night EV0 123 FLOAT chdrEVMinus; ///< Couple HDR EVMinus 124 INT32 motionDetected; ///< Motion Detected 125 BOOL flashNeeded; ///< Whether AE lux_idx should be run at Pre-flash 126 INT32 longExposureSnapshot; ///< Long Exposure Snapshot Flag 127 INT32 isBackLitFace; ///< Flag to indicate is backlit face 128 BOOL isFace; 129 FLOAT faceInterpRatio; ///< Face InterpRatio for ISP, range 0~1 130 INT32 isSIDNeeded; 131 FLOAT sgwRGRatio; ///< BGRegionStats r/g ratio average - simple gray world 132 FLOAT sgwBGRatio; ///< BGRegionStats b/g ratio average - simple gray world 133 FLOAT averageLuma; 134 FLOAT faceLuma; 135 INT32 adrcBracketDetected; 136 /* added by weidong.lin@Cam.Tuning, 201812126, add for AE-ISP face status sync */ 137 FLOAT faceLumaRatio; 138 UINT32 filterFaceCnt; 139 FLOAT faceMaxSize; 140 BOOL isFaceActive; 141 UINT64 countDown4NightMode; 142 UINT64 countDown4TripodMod; 143 FLOAT origLuxIndex; 144 FLOAT underExpRatio; 145 /*weidong.lin@camera, 20200316, added for AIS feature */ 146 BOOL isICENeeded; ///< AIS flag 147 BOOL isWithinICETriggerRgn; ///< ICE current flag for deciding if single frame shot 148 INT32 ICETriggerRgnType; ///< ICE Trigger Region Type 149 INT32 ICECurMotionType; ///< ICE current motion detected 150 INT32 enableStatic2IPE; ///< ICE control flag for 2IPE 151 AECCustomHdrSwitchType preparedSwitchMode; 152 AECCustomHdrSwitchType startSwitchMode; 153 INT32 face1DLUT[FACE_1D_LUT_SIZE + 1]; ///< index 0 means enable flag, 1-257 means the face curve 154 INT32 faceBGLUT[FACE_1D_LUT_SIZE + 1]; ///< index 0 means enable flag, 1-257 means the portrait background curve 155 FLOAT sensitivityForExpIndexZero; ///< The true sensitivity corresponding to the starting point of the exposure table 156 INT32 flickerMode; 157 FLOAT flickerFrequency; 158 AECCustomApsHdrState aecHdrState; 159 FLOAT touchLuma; 160 FLOAT preRealAdjMaxEV; ///< the real effective max EV to apply for preview mode 161 BOOL isProfessionalMode; 162 FLOAT syncSensitivity[AEC_CUSTOM_EXP_MAX]; 163 FLOAT capturePortraitDarkBoostEV; 164 FLOAT capturePortraitFaceEV; 165 };
最新发布
08-29
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值