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.1 Thematic maps

1 tiffdir          <- file.path(system.file(package="TeMa"), 
2 ...                               "sampleimages")

Modern computer graphics systems allow us to generate photorealistic images that are hardly distinguishable from real world imagery. A significant advantage is that, by using a flexible scene description language we can generate not only optical images, but also perfectly aligned descriptive maps, providing us, with pixel level precision, information on the object depicted, its distance from the viewing camera, and also its object centric (UV) coordinates.

This information can be used to implement optical effects on the final rendered image and to gauge the performance of object detection algorithms in a complete automatic way.

The scripts provided allow you to generate a depth map and a label image:

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

This result in the generation of two images and which are provided as sample TeMa images (see Figure B.1). Depth information is stored across the color channels and must be recovered usin tm.getDepth.

1   label <- as.animage(read.pnm(file.path(tiffdir, 
2 ...                       "perspLabel_gretag_small_daylight.ppm"))) 
3   depth <- tm.getDepth(file.path(tiffdir, 
4 ...                          "pp_perspLabel_gretag_small_daylight.ppm"), 
5 ...                           depthScale = 40) 
6   tm.dev("figures/maps", width=6, height=3) 
7   par(mfrow = c(1,2)) 
8   ia.show(label, main="object map") 
9   ia.show(depth, main="depth map") 
10   dev.off()


PIC

Figure B.1: It is possible to generate an image where all the pixels of an object have a distinct color (left) or the distance of the corresponding object point from the camera.