SPDecolor.m

SPDecolor - contrast preserving color to gray by Semi-Parametric optimization

You are now following this Submission

%SPDecolor - contrast preserving color to gray by Semi-Parametric optimization
% S = SPDecolor(Im, sigma) performs contrast preserving decolorization
% on color image Im, with controling parameter sigma
%
% Paras:
% @Im : Input image (double), only color images are acceptable.
% @sigma : Controlling parameter defined in [1]. 5e-3 by default.
%
% Example
% ==========
% Im = im2double(imread('5.png'));
% gIm = SPDecolor(Im); % Default Parameters (sigma = 1e-2)
% figure, imshow(Im), figure, imshow(gIm);
clear all;close all;

%input image
Im = im2double(imread('5.png'));

%process image
gIm1 = cprgb2gray(Im);
gIm2 = rgb2gray(Im);
gIm3 = SPDecolor(Im);

%display image
figure(2000), imshow([Im,repmat([gIm1,gIm2,gIm3],[1,1,3])]);

Cite As

Qiegen Liu (2026). SPDecolor.m (https://www.mathworks.com/matlabcentral/fileexchange/55220-spdecolor-m), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0