【发布时间】:2017-11-25 01:49:07
【问题描述】:
我在 matlab 中工作,我想对灰度图像和 RGB 图像应用对比度拉伸, 所以对于灰度我已经尝试过这个并且它有效
clear all;
clc;
itemp = imread('cameraman.tif'); %read the image
i = itemp(:,:,1);
rtemp = min(i); % find the min. value of pixels in all the
columns (row vector)
rmin = min(rtemp); % find the min. value of pixel in the image
rtemp = max(i); % find the max. value of pixels in all the
columns (row vector)
rmax = max(rtemp); % find the max. value of pixel in the image
m = 255/(rmax - rmin); % find the slope of line joining point
(0,255) to (rmin,rmax)
c = 255 - m*rmax; % find the intercept of the straight line
with the axis
i_new = m*i + c; % transform the image according to new slope
figure,imshow(i); % display original image
figure,imshow(i_new); % display transformed image
这是灰度图像,
问题是我不知道如何处理 RGB 图像 任何想法?如何实施? 谢谢你:)
【问题讨论】:
标签: matlab