extracting the channels from the corrected image
7 次查看(过去 30 天)
显示 更早的评论
iam working with rgb fundus images
my task is to convert the rgb image to hsv space and extract the channels and
perform brightness correction in the image
now i am little confused on how to extract the channels of the corrected image
the corrected image is not saved as jpg format
could anyone help me to solve this issue
i have also attached the coding
thank you in advance
回答(1 个)
Ameer Hamza
2020-4-12
You converted the image to RGB after applying correction. You can extract the RGB channels by indexing along third dimension
R = newRGBImage(:,:,1);
G = newRGBImage(:,:,2);
B = newRGBImage(:,:,3);
29 个评论
LAXMI PRIYANKA
2020-4-13
iam getting the folowing error
Undefined function 'newRGBImage' for input arguments of type 'char'.
Ameer Hamza
2020-4-13
LAXMI, the newRGBImage is defined in your code. Add this after these lines in your code
meanV = mean2(V);
newV = meanV + 1.5 * (V - meanV); % Increase contrast by factor of 1.5
newS = 1.5 * S; % Increase contrast by factor of 1.5
newHSVImage = cat(3, H, newS, newV);
newRGBImage = hsv2rgb(newHSVImage);
R = newRGBImage(:,:,1);
G = newRGBImage(:,:,2);
B = newRGBImage(:,:,3);
LAXMI PRIYANKA
2020-4-14
it worked great thank you sir
i would also like to ask you another help regarding applying CLAHE to the extraxcted green channel
i have been searching for weeks together and would be really happy if you could hep me with the source code
thanking you in advance
LAXMI PRIYANKA
2020-4-14
i read it sir
when i use clahe i get the following error
Undefined function 'localcontrast' for input arguments of type 'double'.
i have also attached the codings
Ameer Hamza
2020-4-14
Change the line 40 and 41 in your code to
data = localcontrast(im2uint8(newRGBImage), edgeThreshold, amount);
PSNR1 = psnr(im2double(data), newRGBImage);
LAXMI PRIYANKA
2020-4-14
sir just now tried those codins with rgb image in the place of tif image
not working
getting errors
Error using adapthisteq
Expected input number 1, I, to be two-dimensional.
Error in adapthisteq>parseInputs (line 416)
validateattributes(I, {'uint8', 'uint16', 'double', 'int16', 'single'}, ...
Error in adapthisteq (line 154)
[I, selectedRange, fullRange, numTiles, dimTile, clipLimit, numBins, ...
Error in s (line 2)
J = adapthisteq(I,'clipLimit',0.02,'Distribution','rayleigh');
Error using adapthisteq
Expected input number 1, I, to be two-dimensional.
Error in adapthisteq>parseInputs (line 416)
validateattributes(I, {'uint8', 'uint16', 'double', 'int16', 'single'}, ...
Error in adapthisteq (line 154)
[I, selectedRange, fullRange, numTiles, dimTile, clipLimit, numBins, ...
Undefined function or variable 'L'.
Undefined function or variable 'L'.
Undefined function 'rgb2lab' for input arguments of type 'double'.
LAXMI PRIYANKA
2020-4-14
i tried with the coding in line 40 and 41
error displayed as
Undefined function 'localcontrast' for input arguments of type 'uint8'.
LAXMI PRIYANKA
2020-4-14
will this be due to the version of matlab?
i am currently using matlab2014a
if it is that i have to install the latest or the next version say2015 or higher
what should i do at this time
help me please with this regard
Ameer Hamza
2020-4-14
I am not sure if this is related to MATLAB version. I am running the code on R2020a.
Ameer Hamza
2020-4-15
The code works fine on R2020a using this image, but there is any error when making the final figures. There is a mistake in typing the name of variables. There is no variable name image in your code, but these lines are trying to call imshow on it.
figure('name','LCM-CLAHE','NumberTitle','off')
%da=adapthisteq(data);
%%%% <------ There is no variable named image in your code
imshow([image uint8(output)]); % Concatenate original and CLAHE image
figure('name','Histogram of input image','NumberTitle','off'); imhist(image); %Show the histogram of original image, LCM output and CLAHE output
figure('name','Histogram of LCM output','NumberTitle','off');imhist(data);
figure('name','Histogram of CLAHE output','NumberTitle','off');imhist(uint8(output));
PSNR = psnr(uint8(output), image);
fprintf('\n The Peak-SNR value of LCM-CLAHE is %0.4f', PSNR);
normal = adapthisteq(image,'clipLimit',0.02,'Distribution','rayleigh');
%imshow([image normal]);
PSNR0 = psnr(normal,image);
fprintf('\n The Peak-SNR value of CLAHE is %0.4f', PSNR0);
he = histeq(image);
PSNR2 = psnr(he,image);
fprintf('\n The Peak-SNR value of HE is %0.4f', PSNR2);
LAXMI PRIYANKA
2020-4-15
sir could u help me to solve the error
what should i specify in the place of image in the coding
Ameer Hamza
2020-4-15
I am not sure. I also though this, but output just have one channel and newRGBImage has three channel so the lines
imshow([newRGBImage uint8(output)]);
..
..
PSNR0 = psnr(normal,newRGBImage);
give error.
LAXMI PRIYANKA
2020-4-15
sir
i have to apply clahe for the green channel extracted from the newRGBImage
so now i'll try with the G channel , but the G channel is of data type
double ie 960x1440 double
what should i do please help me
LAXMI PRIYANKA
2020-4-15
data = localcontrast(im2int8(G), edgeThreshold, amount);
PSNR1 = psnr(im2double(data), G);
Error: Undefined function 'im2int8' for input arguments of type 'double'.
Undefined function or variable 'data'.
Ameer Hamza
2020-4-15
The correct function name is im2uint8, not im2int8
data = localcontrast(im2uint8(G), edgeThreshold, amount);
LAXMI PRIYANKA
2020-4-15
Undefined function 'localcontrast' for input arguments of type 'uint8'. again i get the same error
LAXMI PRIYANKA
2020-4-15
Warning: Image is too big to fit on screen; displaying at 50%
> In imuitools\private\initSize at 71
In imshow at 282
In maincodecheck at 25
Warning: Image is too big to fit on screen; displaying at 50%
> In imuitools\private\initSize at 71
In imshow at 282
In maincodecheck at 31
Warning: Image is too big to fit on screen; displaying at 50%
> In imuitools\private\initSize at 71
In imshow at 282
In maincodecheck at 33
Undefined function 'localcontrast' for input arguments of type 'uint8'.
Error in maincodecheck (line 40)
data = localcontrast(im2uint8(G), edgeThreshold, amount);
these are the errors which i get while running the coding as a whole
Ameer Hamza
2020-4-15
Rest are errors. The actual warning is
Undefined function 'localcontrast' for input arguments of type 'uint8'.
Which is probably caused by the old version of MATLAB. I am not sure which input type is compatible with localcontrast in this version of MATLAB.
LAXMI PRIYANKA
2020-4-15
ok sir thank you for your help
and is it possible to guide me so as to get the udated version of Matlab
i am also trying with other codings and i'll ask you after executing the codes
Ameer Hamza
2020-4-15
If you don't already have one, you will need to get a MATLAB license to use the latest release.
Ameer Hamza
2020-4-15
Depend on your requirement and the license type applicable to you. get more information here: https://www.mathworks.com/pricing-licensing.html
LAXMI PRIYANKA
2020-4-15
sir now i tried with adaphist function for applying clahe
[f_name p_name]=uigetfile('*','select the image');
input_img=imresize(imread(strcat(p_name,f_name)),[512,512]);
imshow(input_img),title('Input Image');
[xRes,yRes]=size(input_img);
Min=0;
Max=255;
NrX=2;
NrY=2;
NrBins=256;
Cliplimit=0.01;
% I = imread('tire.tif');
J = adapthisteq(im2uint8(input_img),'clipLimit',0.02,'Distribution','rayleigh');
imshowpair(im2uint8(input_img),J,'montage');
title('Original Image (left) and Contrast Enhanced Image (right)')
the abve codings after execution displays the following error
Error using adapthisteq
Expected input number 1, I, to be two-dimensional.
Error in adapthisteq>parseInputs (line 416)
validateattributes(I, {'uint8', 'uint16', 'double', 'int16', 'single'}, ...
Error in adapthisteq (line 154)
[I, selectedRange, fullRange, numTiles, dimTile, clipLimit, numBins, ...
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing and Computer Vision 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)