www.gusucode.com > IPCV_Eval_Kit_R2019a_0ce6858工具箱matlab程序源码 > IPCV_Eval_Kit_R2019a_0ce6858/code/demo_files/I2_03_5_contrast_lut.m

    %% 僐儞僩儔僗僩挷惍 梡偺奺庬娭悢 %%%%%%%%
clear;clc;close all;imtool close all

%% 夋憸撉崬傒
G = rgb2gray(imread('I2_03_peppers_low.png'));  % 僌儗乕僗働乕儖傊曄姺
figure;imshow(G);

%% 儖僢僋傾僢僾僥乕僽儖偺嶌惉 (夋憸偑uint8偺応崌丄uint8偺256梫慺偺僥乕僽儖傪嶌惉)
in  = [0 1 70 120 180 255];
out = [0 1 15 150 230 255];
figure; plot(in,out); ylim([0 255]);
%% 嬫暘揑 3 師僄儖儈乕僩撪憓懡崁幃偱撪憓
LUT = uint8(interp1(in, out, 0:255, 'pchip'));
hold on;
plot(LUT);
hold off;

%% 儖僢僋傾僢僾僥乕僽儖揔梡 ()
G1 = intlut(G, LUT);
figure;imshow([G, G1]);
%% 廔椆

% imshowpair偼丄僨僼僅儖僩偱偼婸搙偑僗働乕儕儞僌偝傟傞偺偱拲堄
% Copyright 2014 The MathWorks, Inc.