Extended RGB2Gray Conversion Model for Efficient Contrast Preserving Decolorization

Extended RGB2Gray Conversion Model for Efficient Contrast Preserving Decolorization
133 Downloads
Updated 17 May 2016

View License

% Distribution code Version 1.0 -- 06/20/2015
% All rights reserved.
% This work should only be used for nonprofit purposes.
%
% Please cite the paper when you use the code:
% The Code is created based on the method described in the following paper
% [1] "Extended RGB2Gray Conversion Model for Efficient Contrast Preserving Decolorization",
% Qiegen Liu, Jiaojiao Xiong, Li Zhu, Minghui Zhang, Yuhao Wang, Multimedia Tools and Applications, 2016.
% Copyright 2015, Nanchang University.
% The code and the algorithm are for non-comercial use only.

% Three parameters for EGcs(Im,Lpp1, Lpp2,W);
% Lpp1---the parameter tau in the paper
% Lpp2---the parameter p in the paper
% W---the weight parameter space of the R, G ,B channels

clear all;close all;

%% load input image
Imname{8}='8.png'; %'CSDD8.png'; %
load Extended_weiW5;W = Extended_weiW5;
Im = im2double(imread(Imname{8}));

%% EGcs
[gIm1,Es1,bw1] = EGcs(Im,0.001, 1,W);gIm12 = (gIm1- min(gIm1(:)))/(max(gIm1(:)) - min(gIm1(:)));
[gIm2,Es2,bw2] = EGcs(Im,0.005, 1,W);gIm22 = (gIm2- min(gIm2(:)))/(max(gIm2(:)) - min(gIm2(:)));
[gIm3,Es3,bw3] = EGcs(Im,0.01, 1,W);gIm32 = (gIm3- min(gIm3(:)))/(max(gIm3(:)) - min(gIm3(:)));
[gIm4,Es4,bw4] = EGcs(Im,0.1, 1,W);gIm42 = (gIm4- min(gIm4(:)))/(max(gIm4(:)) - min(gIm4(:)));
[gIm5,Es5,bw5] = EGcs(Im,0.5, 1,W);gIm52 = (gIm5- min(gIm5(:)))/(max(gIm5(:)) - min(gIm5(:)));
[gIm6,Es6,bw6] = EGcs(Im,1, 1,W);gIm62 = (gIm6- min(gIm6(:)))/(max(gIm6(:)) - min(gIm6(:)));

%% display the results
imageall = [Im,repmat([gIm12,gIm22,gIm32,gIm42,gIm52,gIm62],[1 1 3])];
figure(1000), imshow(imageall);

Cite As

Qiegen Liu (2024). Extended RGB2Gray Conversion Model for Efficient Contrast Preserving Decolorization (https://www.mathworks.com/matlabcentral/fileexchange/57160-extended-rgb2gray-conversion-model-for-efficient-contrast-preserving-decolorization), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0