Intensity scaling in RGB image
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm going to compress the intensity scale of RGB image (unit8) to eliminate the extreme bright and extreme dark pixels through remapping the the unscaled intensity I, given by I=R+G+B, of range 0-765 to a narrower range 300-490. So, I think the following actions can be used:
- RGB--->Grayscale (calculating the Intensity)
- intensity adjustment (through imadjust)
- Gray---->RGB
as expalined above, I want to calculate the Intensity given by I=R+G+B; but I think the (rgb2gray) can not be used for the first action since it calculates the intensity by I=gray = 0.2989 * rgb(:,:,1) + 0.5870 * rgb(:,:,2) + 0.1140 * rgb(:,:,3); So, I really appreciate that guide me that my approach is correct or not? If it's wrong, please let me know the solution in Matlab.
0 Kommentare
Antworten (1)
Image Analyst
am 2 Jul. 2014
Why are you doing all that? Why can't you just do
RGBNew = double(rgbImage) / 765 * 190 + 300;
11 Kommentare
Image Analyst
am 2 Jul. 2014
Bearbeitet: Image Analyst
am 2 Jul. 2014
What I gave you didn't work because I thought that those were the gray values of the individual color channels, not the sum of all 3 color channels. Rather than give me some values that might only work for some specific image, why don't you give the formula that they recommend you use for images in general? For example some people use normalized RGB where they extract the individual color channels and then divide by the sum of (R+G+B).
redChannel = double(rgbImage(:, :, 1));
greenChannel = double(rgbImage(:, :, 2));
blueChannel = double(rgbImage(:, :, 3));
% Display the individual color channels.
subplot(2, 4, 2);
imshow(redChannel, []);
title('Red Channel of Original Image', 'FontSize', fontSize);
subplot(2, 4, 3);
imshow(greenChannel, []);
title('Green Channel of Original Image', 'FontSize', fontSize);
subplot(2, 4, 4);
imshow(blueChannel, []);
title('Blue Channel of Original Image', 'FontSize', fontSize);
magnitudeImage = sqrt(redChannel .^2 + greenChannel .^2 + blueChannel.^2);
subplot(2, 4, 5);
imshow(magnitudeImage, []);
title('Magnitude Image');
normRed = redChannel ./ magnitudeImage;
normGreen = greenChannel ./ magnitudeImage;
normBlue = blueChannel ./ magnitudeImage;
subplot(2, 4, 6);
imshow(normRed, []);
title('Normalized Red Image');
subplot(2, 4, 7);
imshow(normGreen, []);
title('Normalized Green Image');
subplot(2, 4, 8);
imshow(normBlue, []);
title('Normalized Blue Image');
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

