How to apply the same white balance to a series of images in matlab?
8 次查看(过去 30 天)
显示 更早的评论
Hi, I have images taken every second of a fluid moving between two parallel plates. I am using RAW images from a canon 50d camera that I have converted to a .dng format, linearized, and demosaiced in matlab. However, my images have a greenish-tint to them after I view them in matlab after applying the code I have to demosaic them. I have been reading various blogs and other forums online and have noticed that other people typically have images with a greenish tint to them as well. They recommend white balancing the images to get rid of this greenish hue. However, I can't seem to really grasp how to apply a white balance to my images in matlab, I also cannot use an "auto" white balancing code because I need to control every step in the image processing for every image (I need to apply the same code to every image, since this is scientific work as opposed to just recreational work). I hope this makes sense, Thanks!
0 个评论
采纳的回答
Image Analyst
2017-12-12
编辑:Image Analyst
2017-12-12
You need to have something in your image that you know for a fact is defined to be white. For example, the X-rite Color Checker Chart is embedded in each snapshot. Then segment or extract the white region, and multiply each color channel by the appropriate factor such that all white region intensities (in each color channel) all have the same value. This simple method should probably be good enough for your situation, though there are more sophisticated methods.
0 个评论
更多回答(1 个)
Mahmoud Afifi
2019-8-12
You can use any simple algorithm to estimate the illuminant value instead of manually picking it. Here is an example of using gray-world algorithm to white balance your raw images.
I = reshape(image,[],3);
R = mean(I(:,1)); G = mean(I(:,2)); B = mean(I(:,3));
ill = [R G B];
I = I * diag(G./ill);
I(I>1) = 1; I(I<0) = 0;
outImage = reshape(I,size(image));
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!