In practice the image brightness measurements will be corrupted by quantization error and noise so that we cannot expect gb to be identically zero. This quantity will tend to have an error magnitude that is proportional to the noise in the measurement. This fact guides us in choosing a suitable weighting factor, denoted by a2, as will be seen later. Let the total error to be minimized be