SPDecolor.m
%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 (2024). SPDecolor.m (https://www.mathworks.com/matlabcentral/fileexchange/55220-spdecolor-m), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Graphics > Images > Modify Image Colors >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |