% ================================================================= % == == % == An Introduction to ARTIFICIAL INTELLIGENCE == % == Janet Finlay and Alan Dix == % == UCL Press, 1996 == % == == % ================================================================= % == == % == chapter 8, image processing utilities == % == images from examples in book == % == == % == Prolog example, Alan Dix, September 1997 == % == == % ================================================================= % The examples in this file all use the list of lists representation % of images as defined in the file 'image.p'. % They are each stored using the 'image/4' predicate in the form: % image( Name, Width, Height, Image ). % Figure 8.2 (page 166) image('figure 8.2', 15, 11, [ [ 0,0,0,0,0,1,2,2,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,4,6,6,5,1,0,0,0,0,0 ], [ 0,0,0,0,5,5,6,6,6,6,8,8,8,5,0 ], [ 0,0,0,0,5,5,6,6,6,6,8,9,9,6,0 ], [ 0,0,1,1,6,6,6,6,6,6,8,9,9,6,0 ], [ 0,0,1,1,5,6,6,6,6,5,2,9,9,6,0 ], [ 0,0,1,1,1,3,6,5,4,1,1,9,9,6,0 ], [ 0,0,1,1,1,1,1,1,1,1,1,9,9,6,0 ], [ 0,0,1,1,1,1,1,1,1,1,1,8,8,5,0 ], [ 0,0,1,1,1,1,1,1,1,1,1,1,6,6,0 ], [ 0,0,1,1,0,0,0,1,1,1,0,1,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] ] ). % Figure 8.5 (page 170) image('figure 8.5', 6, 6, [ [ 0,1,2,2,0,0 ], [ 0,4,6,6,5,1 ], [ 5,5,6,6,6,6 ], [ 5,6,6,6,6,5 ], [ 1,3,2,3,3,3 ], [ 0,2,3,7,5,8 ] ] ). % Figure 8.6 (page 171) image('figure 8.6', 6, 6, [ [ 7,7,8,0,0,0 ], [ 8,1,7,1,0,1 ], [ 8,7,7,1,5,0 ], [ 7,8,7,0,1,1 ], [ 3,7,8,1,0,0 ], [ 7,8,7,0,1,1 ] ] ). % Figure 8.7 (page 172) image('gaussian', 5, 5, [ [ 0, 1, 3, 1, 0 ], [ 1,13,30,13, 1 ], [ 3,30,64,30, 3 ], [ 1,13,30,13, 1 ], [ 0, 1, 3, 1, 0 ] ] ). % Figure 8.9 (page 175) image('figure 8.9', 8, 8, [ [ 0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0 ], [ 0,0,0,8,8,8,8,8 ], [ 0,0,0,8,8,8,8,8 ], [ 0,0,0,8,8,8,8,8 ], [ 0,0,0,8,8,8,8,8 ], [ 0,0,0,8,8,8,8,8 ] ] ). % Figure 8.10 (page 175) image('figure 8.10', 8, 8, [ [ 9,9,9,9,9,9,9,9 ], [ 0,9,9,9,9,9,9,9 ], [ 0,0,9,9,9,9,9,9 ], [ 0,0,0,9,9,9,9,9 ], [ 0,0,0,0,9,9,9,9 ], [ 0,0,0,0,0,9,9,9 ], [ 0,0,0,0,0,0,9,9 ], [ 0,0,0,0,0,0,0,9 ] ] ). % Figure 8.16 (page 182) - smae as figure 8.2 image('figure 8.16', Wid, Ht, Image) :- image('figure 8.2', Wid, Ht, Image). % Figure 8.17 (page 184) image('figure 8.17', 8, 8, [ [ 0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0 ], [ 1,1,0,0,0,0,0,0 ], [ 1,1,1,0,0,0,0,0 ], [ 1,1,1,1,0,0,0,0 ], [ 1,1,1,1,1,0,0,0 ], [ 1,1,1,1,1,1,0,0 ], [ 1,1,1,1,1,1,0,0 ] ] ). % RUNNING THIS CODE % % When required images can be retrieved by a goal of the form: % image('figure 8.9', Wid, Ht, Image). % This can be used on its own to examine the image, but is most useful % as part of a more complicated goal which performs further processing % on the image. % % See the file 'image.p' for simple examples using these images. % Also most images are used in a corresponding Prolog example for % the technique demonstrated in the figure.