*******************************************************************
Search for object
*******************************************************************
VIDEO_stObject VIDEO_wSearchObject( byte bColor, enPictureTyp enTyp ){
...
/* searching for average value and peak value of intensity */
if(enTyp = enMonoPicture){ /* black and white image */
bLevel = 0; /* init µO */
k = 0; /* avarage of µH */
for(n = 0; n < nMonoResolution; n+= 4){
wXpos = 0;
for(m = 0; m < nPixelResolution; m++){
wXpos += bMonoPix(m, n); /* sum of values */
if(bMonoPix(m, n) > bLevel){ /* peak detection */
bLevel = bMonoPix(m, n);
}
}
}
k += ((byte)(wXpos / nPixelNumber); /* average */
if((bLevel - k) < 20) return eError; /* image contrast I too bad */
/* define level operator from equation (5)*/
bLevel = k + ((bLevel - k) >> 1); /* bLevel seperates O and B*/
Listing 2—Look at the complicated
equations first. Only simple calculations are necessary.