Fondazione Bruno Kessler - Technologies of Vision

contains material from
Template Matching Techniques in Computer Vision: Theory and Practice
Roberto Brunelli 2009 John Wiley & Sons, Ltd

B.2 Color rendering

The book did not consider specifically the problem of color template matching. However, as briefly pointed out in Chapter TM:2, even when monochromatic images are considered, the details of the full imaging process should be considered. It is possible to generate realistic images of the same scene under different illuminations:

  cd theRenderingWorkshop/povray/visual-lab 
  ./cameras.sh persp gretag           small incandescent 1 
  ./cameras.sh persp gretag           small daylight     1

The resulting images are provided as sample images for package TeMa

1   incandescent <- ia.readAnimage(file.path(tiffdir, 
2 ...                                  "persp_gretag_small_incandescent.tif")) 
3   daylight     <- ia.readAnimage(file.path(tiffdir, 
4 ...                                   "persp_gretag_small_daylight.tif")) 
5   # 
6   tm.dev("figures/differentLights", width=6, height=3) 
7   par(mfrow = c(1,2)) 
8   ia.show(incandescent, main="incandescent") 
9   ia.show(daylight,     main="daylight") 
10   dev.off()

The two color images are shown in Figure B.2.


PIC

Figure B.2: The same scene lit by different illuminants appears different.


If we generate the corresponding luminance images by averaging the color channels

1   iL <- ia.scale(ia.add(incandescent[[1]], 
2 ...                    ia.add(incandescent[[2]], 
3 ...                           incandescent[[3]]))) 
4   dL <- ia.scale(ia.add(daylight[[1]], 
5 ...                    ia.add(daylight[[2]], 
6 ...                           daylight[[3]]))) 
7   # 
8   tm.dev("figures/differentLightsMono", width=6, height=6) 
9   par(mfrow = c(2,2)) 
10   ia.show(iL, main="incandescent") 
11   ia.show(dL,     main="daylight") 
12   hist(iL, main="incandescent",xlab="") 
13   hist(dL, ylab="",main="daylight",xlab="") 
14   dev.off()

we obtain different images (see Figure B.3): monochromatic template matching is affected by the illumination conditions of the scene.


PIC

Figure B.3: Monochromatic images of the same scene under different illumination are different.