GRAY_LINEAR_CVIP
gray_linear_cvip() - Performs linear gray level modification.
Contents
SYNTAX
outImage = gray_linear_cvip( inImage, startGray, endGray, s_gray, slope, change, band)
Input Parameters include:
- inImage - 1-band input image of MxN size or 3-band input image of MxNx3 size. The input image can be of uint8 or uint16 or double class.
- startGray - Initial gray level to modify.
- endGray - Final gray level to modify.
- s_gray - New initial gray level.
- slope - Slope of modifying line.
- change - Change out-of_range pixels to black or keep without modyfing it (0 -> change to black, 1 -> no modification)
- band - The band number to modify.
Output Parameter includes :
- outImage - Linearly modified image.
DESCRIPTION
The function performs gray level modification on a range of values in an image. The user specifies a range of values to change with startGray and endGray, the new gray level to apply at the startGray value, and the function calculates a new value for each subsequent gray value by applying user specified slope to s_gray, until end Gray level is reached. Slope can be positive, negative, or zero. Those values not within the range startGray - endGray can be set to zero or left unmodified. The parameter band specifies which band to modify, which can be a non-negative integer for a specific band or -1 representing all bands.
REFERENCE
1. Scott E Umbaugh. DIGITAL IMAGE PROCESSING AND ANALYSIS: Applications with MATLAB and CVIPtools, 3rd Edition.
EXAMPLE
% Read Image I = imread('butterfly.tif'); % Start gray start_gray = 10; % End gray end_gray = 200; % initial gray level initial_gray = 30; % slope slope = 1.2; % change change = 0; % Band Band = 1; % Call function O = gray_linear_cvip( I, 10, 200, 30, 1.2, 0, 1); % Display input image figure;imshow(I);title('Input Image'); % Display output image figure; imshow(remap_cvip(O));title('Gray level modified Image'); %function returns as double type (range = 0-255)
CREDITS
Author: Norsang Lama, March 2017
Copyright © 2017-2018 Scott
E Umbaugh
For updates visit CVIP Toolbox Website