Now I'm trying to implement a SDLWGW algorithm by the MATLAB. currently I'm referencing from Automatic White Balancing Using Luminance Component and Standard Deviation of RGB Components

The problem is I can't understand how to get a $SDLWA_{R}$ and $\overline{L_{red}(k)}$? Also what if the $L_{weight}(i,j)$ is $0.9$ then how to calculate the bar of $L_{red}(k)$?

I can't understand it.

I want to know that what is the different between $SD_{red}(k)$ and $SD_{red}(l)$?

$$SDLWA_{R}=\sum_{k=1}^{n}\frac{SD_{red}(k)}{\sum_{l=1}^{n}SD_{red}(l)}\times red_{i,j}(k) $$

What is the $SD_{red}(l)$? Especially, what is the $l$?

$$ \sum_{l=1}^{n}SD_{red}(l) $$

Update 1

I have got a question one more,

The paper was written like this L_weight(i,j) is a positive single-peak function (e.g Triangular function or Gaussian function) value for the luminance value at i-th row, j-th column of the k-th block. But I can't understand what is the mean? How can I make L_weight(i,j)? Would you please give me any hint please ?

Update 2

I'm trying to understand a below answer.

Q1. What if I've got a this block then I think that the $k$ is to be $12$ and $p$ is $5$, and $q$ is $5$. am I correct?

Q2. How to get a $\overline{L\_red(k)}$ value as below the case?

Q2-1. Especially, I want to know that what does exactly indicate the $L\_weight(1,1)red_{1,1}(k)$ and $L\_weight(1,1)$, as below the case? I think we know the value of the $red_{1,1}(k)$ But I'm confused that how to know the value of $L\_weight(1,1)$ ?

enter image description here

Update 3

Does anyone know the relationship between Gaussian weight and one Block?

  • 2
    $\begingroup$ The bar denotes the average over a set of pixels. Please try to rewrite it, and propose a beginning of a Matlab code, so that we can help you where you stop understanding $\endgroup$ Mar 4, 2016 at 23:20
  • $\begingroup$ @LaurentDuval would you give some hint about what is the different between x,y and i,j in Figure3? I don't have a quite bit understand. I can to assume that that i,j are involved in K then what is the x,y? $\endgroup$
    – jo mal
    Mar 4, 2016 at 23:47
  • 1
    $\begingroup$ This person has created new accounts to spam questions on this particular topic. It seems like he/she is trying to accomplish a very specific task of image processing, but without the required background and knowledge. Please see: stackoverflow.com/questions/35808504/… $\endgroup$ Mar 5, 2016 at 1:03
  • $\begingroup$ @jojek Thanks, I have no idea, what do you think? $\endgroup$
    – jo mal
    Mar 5, 2016 at 11:01

1 Answer 1


The $k$ and $l$ indices are to be understood with indexes under the $\sum$ sign. They can be called "free variables". Suppose that the block $k$ has only two pixels, then $p=1$ and $q=2$. So $\overline{L\_red(k)} $ is just a weighted average (a kind of center of mass) of the $2$ red components from the two pixels of the block: $$ \frac{L\_weight(1,1)red_{1,1}(k)+L\_weight(1,2)red_{1,2}(k)}{L\_weight(1,1)+L\_weight(1,2)} $$ which gives you a single value for each block. Formula (5) has the same interpretation, you perform the weighted average of those averaged values over blocks, with weights $SD\_red(k)$.

it is quite easy to use Matlab's block processing tools.

  • $\begingroup$ I have updated with some confused things. $\endgroup$
    – jo mal
    Mar 5, 2016 at 15:04
  • $\begingroup$ $L\_weight(i,j)$ is a discrete function with the same size of each block, so you multiply coordinate-wise each pixel of the block by the corresponding pixel in $L\_weight(i,j)$ (Q2-1), sum all $p\times q$ products, and divide by the sum of pixles in $L\_weight(i,j)$ (Q2). On the bottom of page 495, the authors seem to take a constant value. Q1: $p=q=5$, but the block is the first one, $k=1$. $\endgroup$ Mar 5, 2016 at 15:15
  • $\begingroup$ at the Q2, I think the authors said that "L_weight(i,j) is a positive single-peak function (e.g triangular function or Gaussian function) value for the luminance value at i-th row, j-th column of the k-th block." the L_weight doesn't seem to be one constant value. But I'm not sure. $\endgroup$
    – jo mal
    Mar 5, 2016 at 15:26
  • $\begingroup$ You are correct, I talked about the last paragraph. You can use that code to generate 2D windows mathworks.com/matlabcentral/fileexchange/… $\endgroup$ Mar 5, 2016 at 15:31
  • $\begingroup$ But I'm not still understand how to use the Gaussian function to L_weight(i,j). $\endgroup$
    – jo mal
    Mar 5, 2016 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.