How to eliminate uneven illumination from an imgae with respect to another image?
3 次查看(过去 30 天)
显示 更早的评论
One of my approach is like this. I am not sure about this approach
1) There are two images im1 and im2. Extract the R G B content of im1.
2)Calculate the normalized value for each content
3)Reform a color image.
4)Repeat the process for im2
5)Compare each pixel and replace the content of im2 with im1.
I tried to normalize one of the image but didn't get a good output
Image_rgb = imread('aswathy_33_crop.jpg');
Image_rgb = double(Image_rgb);
figure;imshow(uint8(Image_rgb));
Image_red = Image_rgb(:,:,1);
Image_green = Image_rgb(:,:,2);
Image_blue = Image_rgb(:,:,3);
[row,col] = size(Image_rgb(:,:,1));
for y = 1:row
for x = 1:col
Red = Image_red(y,x);
Green = Image_green(y,x);
Blue = Image_blue(y,x);
if(Red == 0 && Green==0 && Blue==0)
Red = 1;
Green = 1;
Blue = 1;
end
NormalizedRed = Red/(Red + Green + Blue);
NormalizedGreen = Green/(Red + Green + Blue);
NormalizedBlue = Blue/(Red + Green + Blue);
Image_red(y,x) = NormalizedRed;
Image_green(y,x) = NormalizedGreen;
Image_blue(y,x) = NormalizedBlue;
end
end
Image_rgb(:,:,1) = Image_red;
Image_rgb(:,:,2) = Image_green;
Image_rgb(:,:,3) = Image_blue;
new_image1 = cat(3, Image_rgb(:,:,1) ,Image_rgb(:,:,2), Image_rgb(:,:,3));
figure; imshow(uint8(255*new_image1));
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150603/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150604/image.jpeg)
5 个评论
回答(1 个)
B.k Sumedha
2015-5-27
Image=imread('aswathy_33_crop.jpg');
Image_rgb =Image;
Image_rgb = imresize(Image_rgb, [400 400]);
Image_rgb = double(Image_rgb);
%figure;imshow(uint8(Image_rgb));
Image_red = Image_rgb(:,:,1);
Image_green = Image_rgb(:,:,2);
Image_blue = Image_rgb(:,:,3);
%figure;imshow(uint8(Image_red));
[row,col] = size(Image_rgb(:,:,1));
for y = 1:row %-->numberof rows in image
for x = 1:col %-->number of columns in the image
Red = Image_red(y,x);
Green = Image_green(y,x);
Blue = Image_blue(y,x);
NormalizedRed = Red/sqrt(Red^2 + Green^2 + Blue^2);
NormalizedGreen = Green/sqrt(Red^2 + Green^2 + Blue^2);
NormalizedBlue = Blue/sqrt(Red^2 + Green^2 + Blue^2);
Image_red(y,x) = NormalizedRed;
Image_green(y,x) = NormalizedGreen;
Image_blue(y,x) = NormalizedBlue;
end
end
Image_rgb(:,:,1) = Image_red;
Image_rgb(:,:,2) = Image_green;
Image_rgb(:,:,3) = Image_blue;
Image_rgb = Image_rgb .* Image_rgb;
imshow(Image_rgb);
Try with this
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 DALSA Sapera Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!