extracting the channels from the corrected image

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

Respuestas (1)

Ameer Hamza
Ameer Hamza el 12 de Abr. de 2020
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 comentarios

LAXMI PRIYANKA
LAXMI PRIYANKA el 13 de Abr. de 2020
iam getting the folowing error
Undefined function 'newRGBImage' for input arguments of type 'char'.
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
LAXMI PRIYANKA el 14 de Abr. de 2020
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
LAXMI PRIYANKA el 14 de Abr. de 2020
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
Change the line 40 and 41 in your code to
data = localcontrast(im2uint8(newRGBImage), edgeThreshold, amount);
PSNR1 = psnr(im2double(data), newRGBImage);
LAXMI PRIYANKA
LAXMI PRIYANKA el 14 de Abr. de 2020
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
LAXMI PRIYANKA el 14 de Abr. de 2020
i tried with the coding in line 40 and 41
error displayed as
Undefined function 'localcontrast' for input arguments of type 'uint8'.
LAXMI PRIYANKA
LAXMI PRIYANKA el 14 de Abr. de 2020
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
Ameer Hamza el 14 de Abr. de 2020
Can you share your input image?
Ameer Hamza
Ameer Hamza el 14 de Abr. de 2020
I am not sure if this is related to MATLAB version. I am running the code on R2020a.
LAXMI PRIYANKA
LAXMI PRIYANKA el 15 de Abr. de 2020
herewith iam attaching my image
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
LAXMI PRIYANKA el 15 de Abr. de 2020
so i am supposed to use newRGBImage in the place of image .
am i right sir
LAXMI PRIYANKA
LAXMI PRIYANKA el 15 de Abr. de 2020
sir could u help me to solve the error
what should i specify in the place of image in the coding
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.
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
LAXMI PRIYANKA el 15 de Abr. de 2020
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'.
The correct function name is im2uint8, not im2int8
data = localcontrast(im2uint8(G), edgeThreshold, amount);
LAXMI PRIYANKA
LAXMI PRIYANKA el 15 de Abr. de 2020
Undefined function 'localcontrast' for input arguments of type 'uint8'. again i get the same error
Ameer Hamza
Ameer Hamza el 15 de Abr. de 2020
What is the complete error message?
LAXMI PRIYANKA
LAXMI PRIYANKA el 15 de Abr. de 2020
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
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
LAXMI PRIYANKA el 15 de Abr. de 2020
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
Ameer Hamza el 15 de Abr. de 2020
If you don't already have one, you will need to get a MATLAB license to use the latest release.
LAXMI PRIYANKA
LAXMI PRIYANKA el 15 de Abr. de 2020
does it cost high
Ameer Hamza
Ameer Hamza el 15 de Abr. de 2020
Depend on your requirement and the license type applicable to you. get more information here: https://www.mathworks.com/pricing-licensing.html
LAXMI PRIYANKA
LAXMI PRIYANKA el 15 de Abr. de 2020
thank you sir
LAXMI PRIYANKA
LAXMI PRIYANKA el 15 de Abr. de 2020
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, ...

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing and Computer Vision en Centro de ayuda y File Exchange.

Preguntada:

el 12 de Abr. de 2020

Comentada:

el 15 de Abr. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by