A simple program for color balancing
Here is the code with the corrections Austin suggested 6 years ago:
%Program for white balancing%
%Author : Jeny Rajan
%usage : W=imbalance(im)
%im is the color image array to be corrected.
[x y z]=size(im);
Ciny = zeros(1,x*y); %
if (b1<(1.5*Db) & b2<(1.5*Dr))
Ciny(cnt:end) = ; %
Matlab code could run,but the speed is ont fast.Maybe there are double for-loop in code.
The function is badly written. There are unused variables lying around, and the 2 for loops could be removed in favor of the usual Matlab tricks for computational efficiency.
The results are not that visually satisfying either - the color temperature is definitely off on some of the images I tried this function on.
hai , i am hussain
i need how to improve an image white balanced , and colour corrected....
plz help me
Thanks this was useful. This script is slow only because of the first double for-loop doing a dynamic memory allocation each time the condition is met. MATLAB is terrible with dynamic memory allocations. Simply add:
Ciny = zeros(1,x*y);
right before the outer for loop (for i=1:x), and then add:
Ciny(cnt:end) = ;
right at the end of the for loop (right above cnt=cnt-1; and then the sort) to get rid of the unused memory. This speeds up the code tremendously.
The program is good. But computationally intensive.
the effect is good enough,better than some comercial software in China ,for exmaple neo imaging.theory based on a taiwan paper on IEEE
program for this paper
A Novel Automatic White Balance Method
For Digital Still Cameras
No commenting of any kind in the file! No description! Mileading keywords. Color or white balances require a calibration file. This does not so is useless.
adding BSD license