extracting the channels from the corrected image
Mostrar comentarios más antiguos
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
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
el 13 de Abr. de 2020
Ameer Hamza
el 13 de Abr. de 2020
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
el 14 de Abr. de 2020
Ameer Hamza
el 14 de Abr. de 2020
What about this: https://www.mathworks.com/help/images/ref/adapthisteq.html
LAXMI PRIYANKA
el 14 de Abr. de 2020
Ameer Hamza
el 14 de Abr. de 2020
Change the line 40 and 41 in your code to
data = localcontrast(im2uint8(newRGBImage), edgeThreshold, amount);
PSNR1 = psnr(im2double(data), newRGBImage);
LAXMI PRIYANKA
el 14 de Abr. de 2020
LAXMI PRIYANKA
el 14 de Abr. de 2020
LAXMI PRIYANKA
el 14 de Abr. de 2020
Ameer Hamza
el 14 de Abr. de 2020
Can you share your input image?
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
el 15 de Abr. de 2020
Ameer Hamza
el 15 de Abr. de 2020
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
el 15 de Abr. de 2020
LAXMI PRIYANKA
el 15 de Abr. de 2020
Ameer Hamza
el 15 de Abr. de 2020
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
el 15 de Abr. de 2020
LAXMI PRIYANKA
el 15 de Abr. de 2020
Ameer Hamza
el 15 de Abr. de 2020
The correct function name is im2uint8, not im2int8
data = localcontrast(im2uint8(G), edgeThreshold, amount);
LAXMI PRIYANKA
el 15 de Abr. de 2020
Ameer Hamza
el 15 de Abr. de 2020
What is the complete error message?
LAXMI PRIYANKA
el 15 de Abr. de 2020
Ameer Hamza
el 15 de Abr. de 2020
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
el 15 de Abr. de 2020
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
el 15 de Abr. de 2020
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
el 15 de Abr. de 2020
LAXMI PRIYANKA
el 15 de Abr. de 2020
Categorías
Más información sobre Image Processing and Computer Vision en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
