3-D IMAGING SYSTEM

Abstract: A 3-dimensional image is obtained from a 2-dimensional display by varying the apparent distance of the image from the viewer on a pixel by pixel basis. This is done by positioning an array of pixel-level optical elements in alignment with the pixels in the image. In a preferred format, each of the optical elements is generally elongate and has a focal length which varies along its length with the result that the point along its length at which light enters the optical element determines the apparent visual distance of the associated pixel from the viewer. In the case of a cathode-ray tube application, controlling the position of entry of the light is done by controlling the electron beam to move a minute distance vertically as it scans horizontally. In a television application, the vertical distance may be determined by a depth component incorporated in the broadcast signal received by a television set. Applications and embodiments relating to computer monitors, film and still printed imagery are also described.

Description: 3-D IMAGING SYSTEM BACKGROUND OF THE INVENTION The present Invention relates to 3-dlmenslonal Image display techniques and, In particular, to such a technique In which the use of special headgear or spectacles Is not required. The presentation of fully 3-dlmenslonal Images has been a serious technological goal for the better part of the twentieth century. As early as 1908, Gabriel Llppman Invented a method for producing a true 3- dlmenslonal Image of a scene employing a photographic plate exposed through a "fly's eye" lenticular sheet of small fixed lenses. This technique became known as "Integral photography", and display of the developed Image was undertaken through the same sort of fixed lens lenticular sheet. Llppman's development and Its extensions through the years (for example, US Patent No. 3,878,329), however, failed to produce a technology readily amenable to images which were simple to produce, adaptable to motion presentation, or capable of readily reproducing electronically generated images, the predominant format of this latter part of the century. The passage of time has resulted in extensions of the multiple-image-component approach to 3-dlmensional imagery into a variety of technical developments which include various embodiments of ribbed lenticular or lattice sheets of optical elements for the production of stereo images from a single specially processed Image (for example US Patent No. 4,957,311 or US Patent No. 4,729,017, to cite recent relevant examples). Most of these suffer from a common series of deficiencies, which include severe restrictions on the viewer's physical position with respect to the viewing screen, reduced image quality resulting from splitting the produced image intensity between two separate images, and in many, parallax viewable in only one direction. Other prior art techniques for generating real 3- dimenslonal images have included the scanning of a physical volume, either by mechanically scanning a laser beam over a rotating helical screen or diffuse vapour cloud, by sequentially activating multiple internal phosphor screens in a cathode-ray tube, or by physically deviating a pliable curved mirror to produce a variable focus version of the conventional image formation device. All of these techniques have proved to be cumbersome, difficult to both manufacture and view, and overall not readily amenable to deployment in the consumer marketplace. During the same period of time, a variety of technologies relating to viewer-worn appliances emerged, including glasses employing two-colour or cross-polarized filters for the separation of concurrently displayed dual images, and virtual reality display headgear, all related to the production of stereopsis, that is, the perception of depth through the assimilation of separate left- and right- eye images. Some of these have produced stereo images of startling quality, although generally at the expense of viewer comfort and convenience, eye strain, image brightness, and acceptance among a portion of the viewing population who cannot readily or comfortably perceive such stereo imagery. Compounding this is the recently emerging body of ophthalmological and neurological studies which suggest adverse and potentially long-lasting effects from the extended use of stereo imaging systems, user- worn or otherwise. SUMMARY OF THE INVENTION The present invention is intended to provide an improved 3-dimensional imaging device which is compact, simple in structure, and which does not require the use by the viewer of any glasses, virtual reality headgear, or any other user appliance. In order to provide this improved 3-dimensional imaging, the present invention creates a 3-dimensional image by varying the distance of the image from the viewer pixel by individual pixel. The invention employs an array of extremely small, specially designed optical elements which are formed such that the focal length of such element, varies across the surface of the optical element. By minutely displacing the entry point at which light is input to these optics for different pixels within an image, a complete image is presented to the viewer in which certain elements are closer to the viewer and others farther, just as in a real-world scene. The scene presented is orthoscopic, and the viewer's eye focuses nearer for nearer parts of the image, and farther for farther parts of that image. The present invention expressly does not rely for the perception of depth upon the presentation of separate views to the viewer's left and right eyes, thereby overcoming some of the more persistent and more serious flaws inherent in stereoscopic imaging. In one preferred embodiment the optical elements are formed as one or more lenses but may be formed of mirrors instead or indeed a combination of refractive and reflecting surfaces. In its simplest form, the pixels and overlying optical elements are rectangular and the focal length of each optical element varies progressively along the length of the optical element. In this case, the entry point of light is displaced linearly along the length. However, other shapes of optical elements and types of displacement are within the scope of the invention. For example, the optical elements may be circular having a focal length which varies radially with respect to the central optical axis. In such a case the light enters as annular bands which are displaced radially. As well, while the variation in optical characteristics within a pixel-level optical element is illustrated herein as being caused by variations in the shape of physical element surfaces, we have successfully experimented in our laboratory with creating such variation in optical characteristics through the use of gradient index optical materials, in which the index of refraction varies progressively across an optical element. The relationship between the focal length and displacement may be linear or non-linear. A variety of devices may be employed for providing pixel-level light input to the array of plxel- level optics. In one embodiment of the Invention, this light input device is a cathode-ray tube placed behind the array of optics, such that a line of light may be scanned horizontally behind each row of pixel-level optics, and presented at a minutely different vertical displacement from the scan line as it passes behind each optic. In different embodiments, the light input device may be a flat panel display device employing technology such as liquid crystal, electroluminescence or plasma display devices. Electroluminescence devices include LED (light emitting diode) arrays. In all of these embodiments, motion imagery is presented by scanning entire images sequentially, in much the same fashion as with conventional 2-dimensional motion imagery. In this fashion, motion imagery may be presented at frame rates limited only by the ability of the scanned light beam to be minutely vertically manipulated for each pixel. While by no means a limiting range of the technology, the embodiments of the present Invention described herein have successfully operated in our laboratories at frame rates ranging up to 111 frames per second. In still another preferred embodiment, pixel- level, whole image illumination may come from specially prepared motion picture or still photography transparency film, in which each frame of film is illuminated from the rear conventionally, but viewed through an array of the same type of pixel-level optics as above. In this embodiment, each transmitted light pixel within each transparency frame is placed specifically along the linear entry surface of the optics such that its vertical point of input generates a point of light placed at the specific distance from the viewer at which that particular pixel is desired to be perceived, Just as in the electronically illuminated embodiments above. Such conventionally known systems include projecting the 3-D imagery into free space by reflection from a concave mirror or similar image- launching optics. This technique is significantly more compelling than such projection of conventional, flat 2-D imagery, in that the projected 3-D Imagery standing in free space has in fact real, viewable depth. To date, we have successfully employed concave mirrors of spherical, parabolic and hyperbolic mathematics of curvature, but other concave shapes are clearly possible. In all of these embodiments, the 3-dlmensional image may be viewed directly, or employed as the real image source for any conventionally known real image projection system. BRIEF DESCRIPTION OF THE DRAWINGS These and other objects and features of the present invention will become apparent from the following description, viewed in conjunction with the attached drawings. Throughout these drawings, like parts are designated by like reference numbers: FIG. 1(a) is an illustration of one embodiment of a pixel-level optical device, viewed obliquely from the rear. FIG. 1(b) is an illustration of a different embodiment of the same type of pixel-level optical assembly which comprises three optical elements. FIG. 2 illustrates the manner in which varying the point of input of a collimated light bea into the back (input end) of a pixel-level optical device varies the distance in space from the viewer at which that point of light appears. FIG. 3(a) illustrates how this varying Input illumination to a pixel-level optical device may be provided in one preferred embodiment by a cathode-ray tube. FIG. 3(b) illustrates a different view of the varying input illumination, and the alignment of the pixel- level optics with pixels on the phosphor layer of the cathode-ray tube. FIG. 3(c) illustrates the relationship between the size and aspect ratio of the collimated input beam of light to the size and aspect ratio of the pixel-level optical device. FIG. 4(a) illustrates how an array of pixel-level optics is presented across the front of an illumination source such as the cathode-ray tube in a computer monitor, television or other essentially flat screen imaging device. FIG. 4(b) illustrates a second preferred pattern of image tube pixels which may be employed for the purpose. FIG. 5 illustrates the manner in which the depth signal is added to the horizontally scanned raster lines in a television or computer monitor image. FIG. 6 illustrates how the specific point of light input to pixel-level optics may be varied using motion picture film or some other form of illuminated transparency as the illumination source. FIG. 7 illustrates how an array of pixel-level optics may be employed to view a continuous strip of motion picture film for the viewing of sequential frames of film in the display of 3-dimensional motion pictures. FIG. 8 illustrates a method whereby the depth component of a recorded scene may be derived through image capture which employs one main imaging camera and one secondary camera. FIG. 9(a) illustrates the process by which a depth signal may be retroactively derived for conventional 2-dlmenslonal Imagery, thereby making that Imagery capable of being displayed in 3 dimensions on a suitable display device. FIG. 9(b) illustrates the interconnection and operation of image processing devices which may be employed to add depth to video imagery according to the process illustrated in Fig. 9(a). FIG. 10 illustrates the application of the pixel- level depth display techniques derived In the course of these developments to the 3-dimensional display of printed images. FIG. 11 illustrates the energy distribution of the conventional NTSC video signal, Indicating the luminance and chrominance carriers. FIG. 12 illustrates the same NTSC video signal energy distribution, but with the depth signal encoded into the spectrum. FIG. 13(a) illustrates the functional design of the circuitry within a conventional television receiver which typically controls the vertical deflection of the scanning electron beam in the cathode-ray tube. FIG. 13(b) illustrates the same circuitry with the addition of the circuitry required to decode the depth component from a 3-D-encoded video signal and suitably alter the behaviour of the vertical deflection of the scanning electron beam to create the 3-D effect. FIG. 14 illustrates a preferred embodiment of the television-based electronic circuitry which executes the depth extraction and display functions outlined in Fig. 13(b) . FIG. 15 illustrates an alternative pixel-level optical structure in which the position of the input light varies radially rather than linearly. FIG. 16 is similar to FIG. 2 but illustrating an alternative means for varying the visual distance from the viewer of light emitted from an individual pixel. FIG. 17 illustrates how the arrangement shown in FIG. 16 is achieved In a practical embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT OF THE INVENTION Fig. 1(a) illustrates in greatly magnified form one possible embodiment of an optical element 2 employed to vary the distance from the viewer at which a collimated point of light input into this device may appear. For reference purposes, the size of such an optical element may vary considerably, but is Intended to match the size of a display pixel, and as such, will be typically, for a television monitor, in the order of 1 mm in width and 3 mm in height. Optics as small as 0.5 mm by 1.5 mm have been demonstrated for a computer monitor which is designed to be viewed at closer range, and as large as 5 mm wide and 15 mm high, a size intended for application in a large-scale commercial display designed for viewing at a considerable distance. The materials from which these pixel-level optics have been made have been, to date, either fused silica glass (index of refraction of 1.498043), or one of two plastics, being polymethyl methacrylate (Index of refraction of 1.498) or methyl methacrylate (index of refraction of 1.558). There Is, however, no suggestion made that these are the only, or even preferred, optical materials from which such pixel-level optics may be fabricated. In Fig. 1(a) the pixel-level optical element Is seen obliquely from the rear, and as may be seen, while the front surface 1 of this optical device is consistently convex from top to bottom, the rear surface varies in shape progressively from convex at the top to concave at the bottom. Both linear and non-linear progressions in the variation of optical properties have been employed successfully. A collimated beam of light is projected through the optical device in the direction of the optical axis 3, and as may be seen, the collective optical refracting surfaces of the device through which that collimated light beam passes will vary as the beam is moved in input point from the top to the bottom of the device. Although the embodiment illustrated in Figure 1(a) possesses one fixed surface and one variable surface, variations on this design are possible in which both surfaces vary, or in which there are more than two optical refracting surfaces. Figure 1(b), for example, illustrates a second embodiment in which the pixel-level optics are a compound optical device composed of three optical elements. Tests in the laboratory suggest that compound pixel-level optical assemblies may provide Improved image quality and an improved viewing angle over single element optical assemblies and in fact the most successful embodiment of this technology to date employs 3-element optics. However, as single element optical assemblies do operate In this invention as described herein, the pixel-level optical assemblies illustrated throughout this disclosure will be portrayed as single element assemblies for the purposes of clarity of illustration. Fig. 2 illustrates, in compressed form for clarity of presentation, a viewer's eyes 4 at a distance in front of the pixel-level optical element 2. A collimated beam of light may be input to the back of optical device 2 at varying points, three of which are illustrated as light beams 5, 6 and 7. As the focal length of device 2 varies depending upon the input point of the light beam, FIG. 2 illustrates how the resulting point of light will be presented to the viewer at different apparent points in space 5a, 6a or 7a, corresponding to the particular previously described and numbered placement of input beams. Although points 5a, 6a and 7a are in fact vertically displaced from one another, this vertical displacement is not detectable by the observer, who sees only the apparent displacement in depth. Fig. 3(a) Illustrates how, in one preferred embodiment of this Invention, each individual pixel-level optical device may be placed against the surface of a cathode-ray tube employed as the Illumination source. In this drawing, optical element 2 rests against the glass front 8 of the cathode-ray tube, behind which is the conventional layer of phosphors 9 which glow to produce light when impacted by a projected and collimated beam of electrons, illustrated at different positions in this drawing as beams 5b, 6b and 7b. For each of these three illustrative electron beam positions, and for any other beam position within the spatial limits of the pixel-level optical device, a point of light will be input at a unique point on the back of the pixel-level optics. The vertical position of the electron beam may be varied using entirely conventional electromagnetic beam positioning coils as found on conventional cathode-ray tubes, according to a specially prepared signal, although experiments undertaken in the lab have suggested that imagery presented at a high frame rate, that is, substantially over 100 frames per second, may require beam positioning coils which are constructed so as to be more responsive to the higher deflection frequencies inherent in high frame rates. The pattern of phosphors on the cathode-ray tube, however, must match the arrangement of pixel-level optics, in both length and spatial arrangement, that is, an optic must be capable of being illuminated by the underlying phosphor throughout its designed linear input surface. Fig. 3(b) illustrates this arrangement through an oblique rear view of pixel- level optic 2. In this diagram, adjacent phosphor pixels 35, of which 9 are presented, will be of 3 different colours as in a conventional colour cathode-ray tube, and of an essentially rectangular shape. Note that the size and aspect ratio (that is, length to width ratio) of each phosphor pixel matches essentially that of the input end of the pixel-level optic which it faces. As may be seen by observing the phosphor pixel represented by shading, the electron beam scanning this phosphor pixel can be focused at any point along the length of the phosphor pixel, illustrated here by the same 3 representative electron beams 5b, 6b and 7b. The result Is that the point at which light is emitted Is displaced minutely within this pixel. Fig. 3(c) illustrates the importance of the size and aspect ratio of the beam of light which is input to pixel-level optical device 2, here shown from the rear. The visual display of depth through a television tube is more akin in resolution requirement to the display of chrominance, or colour, than to the display of luminance, or black-and-white component, of a video image. By this we mean that most of the perceived fine detail in a video image Is conveyed by the relatively high resolution luminance component of the image, over which a lower resolution chrominance component is displayed. It is possible to have a much lower resolution in the chrominance because the eye Is much more forgiving where the perception of colour is concerned than where the perception of image detail is concerned. Our research in the laboratory has suggested that the eye is similarly forgiving about the perception of depth in a television image. Having said that, however, the display of viewable depth is still generated by the physical movement of a light beam which is input to a linear pixel-level optical device, and it will be obvious that the greater the range of movement of that input light beam, the greater opportunity to Influence viewable depth. In Fig. 3(c), pixel-level optical device 2 is roughly three times as high as it is wide. Collimated input light beam 66a, shown here in cross-section, is round, and has a .diameter approximating the width of optical device 2. Collimated input light beam 66b Is also round, but has a diameter roughly one-fifth of the length of optical device 2. On one hand, this allows beam 66b to traverse a greater range of movement than beam 66a, providing the prospect of a greater ranger of viewable depth in the resulting image, but on the other hand, this is at the expense of a cross-sectional illuminating beam area which Is only approximately 36 per cent of that of beam 66a. In order to maintain comparable brightness in the resulting image, the intensity of input beam 66b will have to be approximately 2.7 times that of beam 66a, an increase which is entirely achievable. Beam 66c is as wide as the pixel-level optical device 2, but is a horizontal oval of the height of beam 66b, that is, only one-fifth the height of optical device 2. This resulting oval cross-section of the illuminating beam is less bright than circular beam 66a, but almost twice as bright as smaller circular beam 66b. This design is highly functional, and is second only to the perfectly rectangular cross-section illuminating beam 66d. This is in fact the beam cross-section employed in our latest and most preferred embodiments of the invention. Fig. 4(a) illustrates how the pixel-level optics 2 are arranged into an array of rows, twelve of which are pictured for illustrative purposes, and how these are placed on the front of an illumination source, here pictured as a cathode-ray tube 10 in one preferred embodiment. As the controlled electron beam is scanned across a row of pixel-level optics, its vertical displacement is altered individually for each pixel, producing a horizontal scan line which is represented for illustrative purposes as line 15, shown both as a dotted line behind the pixel array and separately for clarity as a solid line within the ellipse to the left. As may be seen, the horizontal scan line which, in a conventional cathode- ray display is straight, is minutely displaced from the idline of the scan for each individual pixel, thereby creating an image which, varying in its distance from the viewer as it does pixel by individual pixel, contains substantial resolution in its depth perception. Experience has shown that a minute interstitial gap between the individual pixel-level optical elements minimizes optical "cross-talk" between optical elements, resulting in enhanced image clarity, and that this isolation of the optics can be further enhanced by the Intrusion of a black, opaque material into these interstitial spaces. Interstitial gaps on the order of 0.25 mm have proven to be quite successful, but gaps as small as 0.10 mm have been demonstrated, and have functioned perfectly as optical isolators, most especially when infused with the opaque material referred to above. Arrays of these pixel-level optics have been built through the process of manually attaching each Individual optic to the surface of an appropriate cathode- ray tube using an optically neutral cement. This process is, of course, arduous, and lends Itself to placement errors through the limitations in accuracy of hand-assisted mechanics. Arrays of optics have, however, been very successfully manufactured by a process of producing a metal "master" of the complete array of optics in negative, and then embossing the usable arrays of optics into thermoplastic materials to produce a "pressed" replica of the master which is then cemented, in its entirety, to the surface of the cathode-ray tube. Replication of highly detailed surfaces through embossing has been raised to an artform in recent years through the technical requirements of replicating highly detailed, information-rich media such as laser discs and compact discs, media typically replicated with great accuracy and low cost in inexpensive plastic materials. It Is anticipated that a preferred manufacturing technique for generating mass-produced arrays of pixel-level optics will continue to be an embossing process involving thermoplastic materials. We have, as well, successfully produced in the laboratory arrays of pixel-level optics through the technique of injection molding. To date, three layers of different pixel-level optics, each representing a different optical element, have been successfully aligned to produce an array of 3-element micro-optics. In some preferred embodiments, these layers are cemented to assist In maintaining alignment, but in others, the layers are fixed at their edges and are not cemented together. In the placement of the pixel-level optics onto the surface of the cathode-ray or other light-generating device, precise alignment of the optics with the underlying pixels is critical. Vertical misalignment causes the resulting image to have a permanent bias in the displayed depth, while horizontal misalignment causes constraint of the lateral viewing range afforded by the 3-D display device. As well, the optical linkage between the light- generating pixels and the input surface of the pixel-level optics is enhanced by minimizing where possible the physical distance between the illuminating phosphor and the input surface of the optics. In a cathode-ray tube environment, this implies that the front surface glass of the tube to which the optics are applied should be of the minimal thickness consistent with adequate structural integrity. In large cathode-ray monitors, this front surface may be as thick as 8 mm, but we have successfully illustrated the use of these optics with a specially constructed cathode-ray tube with a front surface thickness of 2 mm. One highly successful embodiment of a cathode-ray tube has been constructed in which the pixel-level optics have actually been formed from the front surface of the tube. Figs. 3(b) and 4(a) illustrate an essentially rectangular pattern of image tube pixels 35 and pixel-level linear optical elements 2, that is, arrays in which the rows are straight, and aligned pixel to pixel with the rows both above and below. This pattern of pixels and optics produces highly acceptable 3-D images, but should not be assumed to be the only such pattern which is possible within the invention. Fig. 4(b) illustrates a second preferred pattern of pixels 35 in which horizontal groups of three pixels are vertically off-set from those to the left and right of the group, producing a "tiled" pattern of three-pixel groups. As this configuration has been built in the laboratory, the three-pixel groups, comprise one red pixel 35r, one green pixel 35g and one blue pixel 35b. As in a conventional 2-D television tube, colour images are built up from the relative illumination of groups, or "triads" of pixels of these same three colours. A different ordering of the three colours is possible within each triad, but the order illustrated in Fig. 4(b) is the embodiment which has been built to date in our laboratory. Fig. 5 illustrates the minute modification by the depth signal of the horizontal scan lines in a raster image such as a conventional television picture. In the conventional cathode-ray television or computer monitor tube shown at the top right of Fig. 5, each Individual picture in a motion sequence is produced by an electron beam which scans horizontally line by line down the screen, illustrated in FIG. 5 by four representative scan lines 17. This highly regular scanning is controlled within the electronics of the television or computer monitor by a horizontal scan line generator 16, and not even variations in the luminance or chrominance components of the signal create variations in the regular top-to-bottom progression of the horizontal scan lines. The present invention imposes a variation on that regularity in the form of the minute displacements from a straight horizontal scan which produce the depth effect. Such variation is physically effected through the use of a depth signal generator 18 whose depth signal is added through adder 19 to the straight horizontal lines to produce the minute variations in the vertical position of each horizontal scan line, producing lines which representatively resemble lines 20, The depth signal generator portrayed in Fig. 5 is a generic functional representation; in a television set, the depth signal generator is the conventional video signal decoder which currently extracts luminance, chrominance and timing Information from the received video signal, and which is now enhanced as described below to extract depth information which has been encoded into that signal in an entirely analogous fashion. Similarly, in a computer, the depth component generator Is the software-driven video card, such as a VGA video card, which currently provides luminance, chrominance and timing Information to the computer monitor, and which will also provide software- driven depth information to that monitor. Fig. 6 illustrates the manner in which a film transparency 14 may be employed to provide the controlled input illumination to the pixel-level optical device 2 in another preferred embodiment of the Invention. In this example, the portion of the film which is positioned behind the illustrated optical element is opaque except for one transparent point designed to allow light to enter the optical device at the desired point. The film-strip is conventionally illuminated from the rear, but only the light beam 5c is allowed through the transparent point in the film to pass through optical element 2. As may be seen, this situation is analogous to the situation in FIG. 3, in which a controlled electron beam in a cathode-ray tube was used to select the location of the illumination beam. The film transparencies employed may be of arbitrary size, and embodiments utilizing transparencies as large as eight inches by ten inches have been built. Fig. 7 illustrates the manner in which an array 11 of pixel-level optical elements 2, twelve of which are pictured for illustrative purposes, may be employed to display imagery from a specially prepared film strip 13. Optical array 11 is held in place with holder 12. An image on film strip 13 is back-lit conventionally and the resulting image focused through a conventional projection lens system, here represented by the dashed circle 22, onto array 11, which is coaxial with film strip 13 and projection lens 22 on optical axis 23. The 3- dimensional image generated may be viewed directly or may be employed as the image generator for a 3-dimensional real image projector of known type. As well, the 3-dlmensional images generated may be viewed as still Images, or in sequence as true 3- dimensional motion pictures at the same frame rates as conventional motion pictures. In this embodiment, the Individual pixels in film strip 13 may be considerably smaller than those utilized for television display, as the resulting pixels are intended for expansion on projection; the resolution advantage of photographic film over television displays easily accommodates this reduction in pixel size. Fig. 8 illustrates a scene in which two cameras are employed to determine the depth of each object in a scene, that is, the distance of any object within the scene from the main imaging camera. A scene to be captured, here viewed from above, is represented here by a solid rectangle 24, a solid square 25 and a solid ellipse 26, each at a different distance from the main imaging camera 27, and therefore each possessing different depth within the captured scene. The main imaging camera 27 is employed to capture the scene in its principal detail from the artistically preferred direction. A secondary camera 28 is positioned at a distance from the first camera, and views the scene obliquely, thereby capturing a different view of the same scene concurrently with the main imaging camera. Well known techniques of geometric triangulation may then be employed to determine the true distance from the main imaging camera which each object in the scene possesses. One preferred manner in which these calculations may be done, and the resulting depth signal generated, is in a post-production stage, in which the calculations related to the generation of the depth signal are done "off-line", that is, after the fact of image capture, and generally at a site remote from that image capture and at a pace of depth signal production which can be unrelated to the pace of real-time image capture. A second preferred manner of depth signal generation is that of performing the requisite calculation in "real-time", that is, essentially as the Imagery is gathered. The advantage of the real-time depth signal generation is that It enables the production of "live" 3-dimensional imagery. The computing requirements of real-time production, however, are substantially greater than that of an "off-line" process, in which the pace may be extended to take advantage of lower, but lower cost, computing capability. Experiments conducted in the laboratory suggest that the method of conducting the required computation in real-time which is preferred for reasons of cost and compactness of electronic design is through the use of digital signal processors (DSP's) devoted to image processing, le. digital image processors (DIP'S), both of these being specialized, narrow-function but high speed processors. As the secondary camera 28 is employed solely to capture objects from an angle different from that of the main imaging camera, this secondary camera may generally be of somewhat lower imaging quality than the main imaging camera, and therefore of lower cost. Specifically within motion picture applications, while the main Imaging camera will be expensive and employ expensive film, the secondary camera may be a low cost camera of either film or video type. Therefore, as opposed to conventional filmed stereoscopic techniques, in which two cameras, each employing expensive 35 mm. or 70 mm. film, must be used because each Is a main imaging camera, our technique requires the use of only one high quality, high cost camera because there is only one main imaging camera. While this comparative analysis of two Images of the same scene acquired from different angles has proved to be most successful, it is also possible to acquire depth cues within a scene by the use of frontally placed active or passive sensors which may not be inherently imaging sensors. In the laboratory, we have successfully acquired a complete pixel-by-pixel depth assignment of a scene, referred to within our lab as a "depth map", by using an array of commercially available ultrasonic detectors to acquire reflected ultrasonic radiation which was used to illuminate the scene. Similarly, we have successfully employed a scanning Infrared detector to progressively acquire reflected infrared radiation which was used to illuminate the scene. Finally, we have conducted successful experiments in the lab employing microwave radiation as the illumination source and microwave detectors to acquire the reflected radiation? this technique may be particularly useful for capturing 3-D imagery through the use of radar systems. Fig. 9(a) illustrates the principal steps in the process by which a depth signal may be derived for conventional 2-dimenslonal imagery, thereby enabling the process of retro-fitting 3-D to conventional 2-D Imagery, both film and video. In Fig. 9(a), the same series of three objects 24, 25 and 26 which were portrayed in a view from above in Fig. 8 are now viewed on a monitor from the front. In the 2-D monitor 29, of course, no difference in depth is apparent to the viewer. In our process of adding the depth component to 2-D imagery, the scene is first digitized within a computer workstation utilizing a video digitizing board. A combination of object definition software, utilizing well- known edge detection and other techniques, then defines each individual object in the scene In question so that each object may be dealt with individually for the purposes of retrofitting depth. Where the software is unable to adequately define and separate objects automatically, a human Editor makes judgmental clarifications, using a mouse, a light pen, touch screen and stylus, or similar pointing device to outline and define objects. Once the scene is separated into individual objects, the human Editor arbitrarily defines to the software the relative distance from the camera, i.e. the apparent depth, of each object in the scene in turn. The process is entirely arbitrary, and it will be apparent that poor judgement on the part of the Editor will result in distorted 3-D scenes being produced. In the next step in the process, the software scans each pixel in turn within the scene and assigns a depth component to that pixel. The result of the process is represented by depth component scan line 31 on monitor 30, which represents the representative depth signal one would obtain from a line of pixels across the middle of monitor scene 29, intersecting each object on the screen. The top view of the placement of these objects presented in Fig. 8 will correlate with the relative depth apparent in the representative depth component scan line 31 in Fig. 9(a). The interconnection and operation of equipment which may be employed to add depth to video imagery according to this process is illustrated in Fig. 9(b) . In this drawing, an image processing computer workstation 70 with an embedded video digitizer 71 controls an input video tape recorder (VTR) 72, and output video tape recorder 73, and a video matrix switcher 74 (control is illustrated with the dashed lines in Fig. 9(b), and signal flow with solid lines). The video digitizer accepts a frame of video from the input VTR through the matrix switcher on command from the workstation. The frame Is then digitized, and the object definition process described in Fig. 9(a) is applied to the resulting digital scene. When the depth signal has been calculated for this frame, the same frame is input to an NTSC video generator 75 along with the calculated depth component, which is added to the video frame in the correct place in the video spectrum by the NTSC generator. The resulting depth-encoded video frame is then written out to the output VTR 73, and the process begins again for the next frame. Several important points concerning this process have emerged during its development in the laboratory. The first such point is that as the depth component is being added by an NTSC generator which injects only the depth component without altering any other aspect of the signal, the original image portion of the signal may be written to the output VTR without the necessity for digitizing the image first. This then obviates the visual degradation imparted by digitizing an image and reconverting to analog form, and the only such degradation which occurs will be the generation-to-generation degradation inherent in the video copy process, a degradation which is minimized by utilizing broadcast format "component video" analog VTR's such as M-II or Betacam devices. Of course, as is well known in the imaging industry, with the use of all-digital recording devices, whether computer-based or tape-based there will be no degradation whatever in the generation-to- generation process. The second such point is that as this is very much a frame-by-frame process, what are termed "frame- accurate" VTR's or other recording devices are a requirement for depth addition. The Editor must be able to access each individual frame on request, and have that processed frame written out to the correct place on the output tape, and only devices designed to access each individual frame (for example, according to the SMPTE time code) are suitable for such use. The third such point Is that the whole process may be put under computer control, and may be therefore operated most conveniently from a single computer console rather than from several separate sets of controls. Given the availability of computer controllable broadcast level component VTR's and other recording devices, both analog and digital, certain aspects of the depth addition process may be semi-automated by exploiting such computer-VTR links as the time-consuming automated rewind and pre-roll. The fourth such point is that the software may be endowed with certain aspects of what is commonly referred to as "artificial intelligence" or "machine intelligence" to enhance the quality of depth addition at a micro feature level. For example, we have developed in the lab and are currently refining techniques which add greater reality to the addition of depth to human faces, utilizing the topology of the human face, i.e. the fact that the nose protrudes farther than the cheeks, which slope back to the ears, etc., each feature with its own depth characteristics. This will alleviate the requirement for much Editor input when dealing with many common objects found in film and video (human faces being the example employed here) . The fifth such point is that the controlling software may be constructed so as to operate in a semi- automatic fashion. By this it is meant that, as long as the objects in the scene remain relatively constant, the controlling workstation may process successive frames automatically and without additional input from the Editor, thereby aiding in simplifying and speeding the process. Of course, the process will once again require Editorial input should a new object enter the scene, or should the scene perspective change inordinately. We have developed in the lab and are currently refining techniques based in the field of artificial intelligence which automatically calculate changes in depth for individual objects in the scene based upon changes in perspective and relative object size for aspects which are known to the software. The sixth such point is that when working with still or motion picture film as the input and output media, the input VTR 72, the output VTR 73 and the video matrix switcher 74 may be replaced, respectively, with a high resolution film scanner, a digital data switch and a high resolution film printer. The remainder of the process remains essentially the same as for the video processing situation described above. In this circumstance, the injection of the depth signal using the NTSC generator is obviated by the film process outlined in Figure 8. The seventh such point is that when working in an all-digital recording environment, as in computer-based image storage, the input VTR 72, the output VTR 73 and the video matrix are switcher 74 are effectively replaced entirely by the computer's mass storage device. Such mass storage device is typically a magnetic disk, as it is in the computer-based editing workstations we employ in our laboratory, but it might just as well be some other form of digital mass storage. In this all-digital circumstance, the injection of the depth signal using the NTSC generator is obviated by the addition to the computer's conventional image storage format of the pixel-level elements of the depth map. Attached as Appendix A is a copy of some of.the software listing used under laboratory conditions to achieve the retro-fitting discussed above with reference to Figures 9(a) and 9(b). Fig. 10 illustrates the application of the pixel- level depth display techniques derived in the course of these developments to the 3-dimensional display of printed images. Scene 32 is a conventional 2-dimensional photograph or printed scene. A matrix 33 of pixel-level microlenses (shown here exaggerated for clarity) is applied over the 2-D image such that each minute lens has a different focal length, and therefore presents that pixel at a different apparent depth to the viewer's eye. Viewed greatly magnified in cross section 34, each microlens may be seen to be specific in shape, and therefore optical characteristics, so as to provide the appropriate perception of depth to the viewer from its particular image pixel. While mlcrolenses with diameters as small as 1 mm have been utilized in our laboratories to date, experiments have been conducted with fractional mm mlcrolenses which conclude that arrays of lenses of this size are entirely feasible, and that they will result in 3-D printed imagery with excellent resolution. In mass production, it is anticipated that the depth signal generating techniques described herein will be employed to produce an imprinting master, from which high volume, low cost microlens arrays for a given image might be, once again, embossed into impressionable or thermoplastic plastic materials in a fashion analogous to the embossing of the data-carrying surfaces of compact discs or the mass-replicated reflection holograms typically applied to credit cards. Such techniques hold the promise of large-scale, low cost 3-D printed imagery for Inclusion in magazines, newspapers and other printed media. While the matrix 33 of mlcrolenses is portrayed as being rectangular in pattern, other patterns, such as concentric circles of mlcrolenses, also appear to function quite well. It is important to note that the picture, or luminance, carrier in the conventional NTSC video signal occupies significantly greater video bandwidth than either of the chrominance or depth sub-carriers. The luminance component of an NTSC video picture is of relatively high definition, and is often characterized as a picture drawn with "a fine pencil". The chrominance signal, on the other hand, is required to carry significantly less information to produce acceptable colour content in a television picture, and is often characterized as a "broad brush" painting a "splash" of colour across a high definition black-and-white picture. The depth signal in the present invention is In style more similar to the colour signal in its limited information content requirements than it is to the high definition picture carrier. One of the critical issues in video signal management is that of how to encode Information into the signal which was not present when the original was constructed, and to do so without confusing or otherwise obsoleting the installed base of television receivers. Fig. 11 illustrates the energy distribution of the conventional NTSC video signal, showing the picture, or luminance, carrier 36, and the chrominance, or colour information, carrier 37. All of the information in the video spectrum is carrier by energy at separated frequency intervals, here represented by separate vertical lines; the remainder of the spectrum is empty and unused. As may be seen from Fig. 11, the architects of the colour NTSC video signal successfully embedded a significant amount of additional information (i.e. the colour) into an established signal construct by utilizing the same concept of concentrating the signal energy at separated frequency points, and then interleaving these points between the established energy frequency points of the picture carrier such that the two do not overlap and Interfere with each other. In a similar fashion, the present invention encodes still further additional information, in the form of the required depth signal, into the existing NTSC video signal construct, utilizing the same interleaving process as is employed with the chrominance signal. Fig. 12 illustrates this process by showing, once again, the same luminance carrier 36 and chrominance sub-carrier 37 as in Fig. 11, with the addition of the depth sub-carrier 38. For reference purposes, the chrominance sub-carrier occupies approximately 1.5 MHz of bandwidth, centred on 3.579 MHz, while the depth sub-carrier occupies only approximately 0.4 MHz, centred on 2.379 MHz. Thus, the chrominance and depth sub-carriers, each interleaved with the luminance carrier, are sufficiently separated so as not to interfere with each other. While the stated sub-carrier frequency and occupied bandwidth work quite well, others are in fact possible. For example, in experiments conducted in the lab, we have successfully demonstrated substantial reduction of the stated 0.4 MHz. bandwidth requirement for the depth sub-carrier by applying well- known compression techniques to the depth signal prior to insertion into the NTSC signal; this is followed at the playback end by decompression upon extraction and prior to its use to drive a depth-displaying imaging device. As well, similar approaches to embedding the depth signal into the PAL and SECAM video formats have been tested in the laboratory, although the specifics of construct and the relevant frequencies vary due to the differing nature of those video signal constructs. In an all-digital environment, as in computer-based image storage, a wide variety of Image storage formats exists, and therefore, the method of adding bits devoted to the storage of the depth map will vary from format to format. Fig. 13(a) illustrates in functional form the circuitry within a conventional television receiver which typically controls the vertical deflection of the scanning electron beam in the cathode-ray tube, using terminology common to the television industry. While some of the details may vary from brand to brand and from model to model, the essentials remain the same. In this diagram representing the conventional design of a television receiver, the object is to generate a sweep of the scanning electron beam which is consistent and synchronized with the incoming video signal. Signal is obtained by Tuner 49 and amplified by Video IF amp 50, then sent to Video detector 51 to extract the video signal. The output of the video detector 51 is amplified in Detector Out Amp 52, further amplified in the First Video Amplifier 53, and passed through a Delay Line 54. Within a conventional video signal, there are 3 major components» the luminance (that is, the brightness, or "black-and-white" part of the signal); the chrominance (or colour part); and the timing part of the signal, concerned with ensuring that everything happens according to the correctly choreographed plan. Of these components, the synchronization information is separated from the amplified signal in the Synchronization Separator 55, and the vertical synchronization information is then inverted in Vertical Sync Invertor 56 and fed to the Vertical Sweep generator 64. The output of this sweep generator is fed to the electromagnetic coil in the cathode-ray tube known as the Deflection Yoke, 65. It Is this Deflection Yoke that causes the scanning electron beam to follow a smooth and straight path as it crosses the screen of the cathode-ray tube. As described earlier, in a 3-D television tube, minute variations in this straight electron beam path are introduced which, through the pixel-level optics, create the 3-D effect. Fig. 13(b) illustrates in the same functional form the additional circuitry which must be added to a conventional television to extract the depth component from a suitably encoded video signal and translate that depth component of the signal into the minutely varied path of the scanning electron beam. In this diagram, the functions outside the dashed line are those of a conventional television receiver as illustrated in Fig. 13(a), and those inside (that dashed line represent additions required to extract the depth component and generate the 3-D effect . As described in Fig. 12, the depth signal is encoded into the NTSC video signal In a fashion essentially Identical to that of the encoding of the chrominance, or colour signal, but simply at a different frequency. Because the encoding process is the same, the signal containing the depth component may be amplified to a level sufficient for extraction using the same amplifier as is used in a conventional television set for amplifying the colour signal before extraction, here designated as First Colour IF amplifier 57. This amplified depth component of the signal is extracted from the video signal in a process identical to that used for extracting the encoded colour in the same signal. In this process, a reference, or "yardstick" signal is generated by the television receiver at the frequency at which the depth component should be. This signal is compared against the signal which is actually present at that freguency, and any differences from the "yardstick" are interpreted to be depth signal. This reference signal is generated by Depth Gate Pulse Former 59, and shaped to its required level by Depth Gate Pulse Llmiter 58. The fully formed reference signal is synchronized to the incoming encoded depth signal for the same Synchronization Separator 55 used to synchronize the horizontal sweep of the electron beam in a conventional television receiver. When the amplified encoded depth signal from First Colour IF Amplifier 57 and the reference signal from Depth Gate Pulse Limlter 58 are merged for comparison, the results are amplified by Gated Depth Synchronization Amplifier 63. This amplified signal will contain both colour and depth components, so only those signals surrounding 2.379 MHz, the encoding frequency of the depth signal, are extracted by extractor 62. This, then, is the extracted depth signal, which is then amplified to a useful level by X'TAL Out Amplifier 61. Having extracted the depth component from the composite video signal, the circuitry must now modify the smooth horizontal sweep of the electron beam across the television screen to enable the display of depth In the resulting image. In order to modify this horizontal sweep, the extracted and amplified depth signal is added in Depth Adder 60 to the standard vertical synchronization signal routinely generated in a conventional television set, as described earlier in Fig. 13(a). The modified vertical synchronization signal which is output from Depth Adder 60 is now used to produce the vertical sweep of the electron beam in Vertical Sweep Generator 64, which, as In a conventional receiver, drives the Deflection Yoke 65 which controls the movement of the scanning electron beam. The end result is a scanning electron beam which is deflected minutely up or down from its conventional centreline to generate a 3-D effect in the video image by minutely varying the input point of light to the pixel-level optics described earlier. Fig. 14 illustrates electronic circuitry which is a preferred embodiment of those additional functions described within the dashed line box in Fig. 13. Fig. 15 illustrates an alternative means of varying the position of the light which is input to a different form of pixel-level optical structure. In this alternative, pixel-level optical structure 39 has an appropriate optical transfer function, which provides a focal length which increases radially outwardly from the axis of the optical element 39 and is symmetrical about its axis 43. Light collimated to cylindrical form is input to the optical structure, and the radius of the collimated light cylinder may vary from zero to the effective operating radius of the optical structure. Three such possible cylindrical collimations 40, 41 and 42 are illustrated, producing from a frontal view the annular input light bands 40a, 41a and 42a respectively, each of which will produce, according to the specific optical transfer function of the device, a generated pixel of light at a different apparent distance from the viewer. FIG. 16 illustrates, in compressed form for clarity of presentation, still another alternative means of varying the visual distance from the viewer of light emitted from a individual pixel. In this illustration, a viewer's eye 4 are at a distance in front of the pixel- level optics. A collimated beam of light may be incident upon an obliquely placed mirror 76 at varying points, three of which are illustrated as light beams 5, 6 and 7. Mirror 76 reflects the input light beam onto an oblique section of a concave mirror 77, which, by the image forming characteristics of a concave mirror, presents the light beam of varying visual distance from the viewer 5a, 6a, and 7a, corresponding to the particular previously described and numbered placement of input beams. The concave mirror may have mathematics of curvature which are of variety of conic sections, and in our laboratory we have successfully employed all of parabolic, hyperbolic and spherical curvatures. In this embodiment, experimental results suggest that both the planar and curved mirrors should be of the first-surface variety. FIG. 17 illustrates how in one preferred embodiment of the arrangement shown in FIG 16, pixel-level combinations of planar mirror 76 and concave mirror 77 are arranged against the surface of a cathode-ray tube employed as an illumination source. In the drawings the concave mirror 77 from one pixel is combined with the planar mirror from the adjacent (immediately above) pixel to form a combined element 78, which rests against the glass front 8 of the cathode-ray tube, behind which are the conventional layers of phosphors 9 which glow to produce light when impacted by a projected and collimated beam of electrons, illustrated at different positions in this drawing as beams, 5b, 6b and 7b. For each of these three illustrative positions, and for any other beam position within the spatial limits of the pixel-level optical device, a point of light will be input at a unique point to the assembly, and will therefore be presented to the viewer at a correspondingly unique point. As with the refractive embodiments of this invention, other light sources than cathode-ray are capable of being employed quite suitably, // 3D0105.cpp APPENDIX A // AGENTS OF CHANGE INC. // Advanced Technology 3-D Retrofitting Controller Software // Employing Touch Screen Graphical User Interface // V.01.05 // Includes the following control elements: -^include <dos.h > #include < stdιo.h> #inciude <conιo.h> #include < graphics. h> #mclude < stdlib.h> #include < string. h > #include < ιostream.h > #defme MOUSE 0x33 ^define BUT1PRESSED 1 #define BUT2PRESSED 2 #defιne TRUE 1 #defme FALSE 0 void ActivMouseO { // activate mouse. _AX=32; genιnterrupt(MOUSE) ; } int ResetMouseO { // mouse reset. _AX=0; genιmerrupt(MOUSE) ; return( AX); } void ShowMouseO { // turn on mouse cursor. _AX= 1 ; gemmerrupt(MOUSE); void HideMouseO { // turn off mouse cursor. _AX=2; genιnterrupt(MOUSE) ; } void ReadMouseOnt *v, int *h, int *but) { ■nt temp: _AX=3; gemmerπιρt(MOUSE) ; // which button pressed: 1 =left. 2=πght, 3=both. temp=_BX; *but=temp; // horizontal coordinates. •h«_CX; // vertical coordinates. » v= DX; } class Bunon // this class creates screen bunons capable of being displayed raised // or depressed. Labels displayed on the bunons change colour when // the bunon is depressed. { public: int button centrex. bunon centrey. bunon width. bunon height; int left, top. right. ottom, text size, text fields. lfont; char button_textl[40). bunon_text2[40]; unsigned upanern; // buπon centrex. bunon centrey is the centre of the button placement. // button width and bunon height are the dimensions of the button in pixels. // bunon text is the label on the button. // text size is the text size for senextstyleO int mouseX. mouse Y. mouseButtoπ: int oldMouseX, oldMouseY; int buttonlDown.button2Down; int pressed: Bunondm x. int y, int width, t height, mt tfields. char *btextl . char *btext2. int tsize. mt // this constructor initializes the bunon variables. { bunon centrex = x; bunon centrey = y; bunon width = width: bunon height = height: strcpy (bunon text 1. btext 1 ) ; strcpy(bunon_text2. btexι2): text_sιze= tsize: text_fιelds=tfιelds: lfont =t; left=button_centrex - button wιdth/2; top=button_centrey - button_heιght/2: right =button_cenιrex + button_wιdth/2: bonom=button_centrey + bunon heιght/2: oldMouseX-0: oldMouseY =0; buttonlDown=FALSE; bunon2Down=FALSE; pressed = FALSE; } // draws a raised button and prints the required label on it. { setcolor(5); setlinestyle(SOLID LINE.upattern.NORM WIDTH); setfιllstyle(SOLID_FILL. UGHTGRAY); ~ bar3d(left,top, right. bottom.0,0) ; setcolor(WHITE); seϋιnestyle(SOUD LINE.upaπern.THICK_WIDTH); 34 lιne(left+2.bonom-l.left+2.top+ l): line(left+ 1.top +2, right- 1 ,toρ+2); setcolor(DARKGRAY); setlinestyle(SOLID_LINE,upattern.NORM_WIDTH); line(left+4.bonom-3,right-l.bottom-3); line(left+3,bonom-2.right-l.bonom-2): line(left+2.bottom-l,right-l.boπom-l); lιne(right-3.bottom-l.right-3.top+4); lιne(right-2.bonom-l,right-2.top+3); lιne(right-l,bonom-l,right-l,top+2); // put the required text in the bunon. setcolor(5); seπextjustify(CENTER_TEXT. CENTER_TEXT); senextstyle(lfont. HORΪZ DIR. text size); co < < buπon_text2 < < endl; if (text_fields= = l) ouπextxy(button_centrex. button_centrey-4*(float(button_height)/50), buπon textl); else { outtextxy(button_centrex, bunon centrey- 13 *(floaι(button_heιght)/50) . button textl); outtextxy! button centrex. buuon_centrey-t-9*(floaι(button_heιght)/50). bunon text2); } pressed = FALSE; } void down() // draw a depressed button and prints the required label on it. { setcolor(5); setlιnestyle(SOLID_LINE.upattern.NORM WIDTH). setfιllstyle(SOLID_FILL. DARKGRAY); ~ bar3d(lefι.top,πght.bottom.0.0): setcolor(S); setlιnestyle(SOLID LINE.upatiern.THICK WIDTH). Iinedeft + 2. bottom- 1. left + 2.top+ l): lιne(left+ l .top+2,πght-l .top+2); setcolor(LIGHTGRAY); setlιnestyle(SOLID_LINE.upattern.NORM_WIDTH). lιne(left+4.bottom-3,πght-l.bottom-3): lιne(left + 3.bottom-2.right-l.boιtom-2); line(left+2.bottom-l,πght-l .bottom-l); line(right-3.bottom-l,πght-3,top-ι-4); lιne(right-2.bottom-l.πght-2,top+3); lιne(rιghι-l.bottom-l ,πght-l .top+2); // put the required text in the button. setcolor(WHITE); settextjustif (CENTER_TEXT. CENTER_TEXT) : settextstyledfont. HORfz_DIR. text_sιze); cout < < button_texι2 < < endl; if (text_fields= = l) outtextxy(button_centrex. button_cenιrey-4*(float(button_heιght)/50.). bunon textl); else { outtextxy (button centrex , bunon centrey- 13 * (float(bunon_height)/50. ) , button textl); outtextxy (button centrex. bunon centre + 9*(float( button_heιght)/50. ) . bunon text2); } presse =TRUE; } int touchedO // determines whether a bunon has been touched, and returns // TRUE for yes, and FALSE for no. Touching is emulated // by a mouse click. { mt temp; _AX=3; genιmermpt(MOUSE): // which bunon pressed- 1 =left, 2=πght, 3=both. temp=_BX; mouseBunon = temp : // horizontal coordinates. mouseX=_CX; // vertical coordinates mouseY=_DX. if (mouseButton&BUTl PRESSED) { buttonlDown=TRUE: return 0: } else if (button 1 Down) // if button 1 was down and is now up. it was clicked! { // check whether the mouse is positioned in the bunon. if ((((mouseX-left)*(mouseX-πght)) <0) && (((mouseY-top)*(mouseY- bottom))<0)) // if this evaluates as TRUE then do the following. { button 1 Down = FALSE; return 1: I buttonlDown = FALSE. return 0: // XXXXXXXXXXXXXXXXXXX MAIN XXXXXXXXXXXXXXXXXXXXX void mainO { // this is the system main. mt Page_l_flag, Page_2_flag, Page_3_flag. Page_4_flag, Page_5_flag; int Page_6_flag, Page_7_flag, Page_8_flag, Page_9_flag, Page_10_flag; char which; // initialize the graphics system, int gdπver = DETECT, gmode. errorcode: initgraph(&gdriver, &gmode, "c:\\borlandc\\bgi"); // read the result of initialization, errorcode = graphresult(); 36 if (errorcode ! = grOk) { // an error occurred. printfC Graphics error: %s\n", grapherrormsg(errorcode)); pπntf("Press any key to halt:"); getchO; exιt(l); } //if (!ResetMouse()) //{ // pπntf("No Mouse Driver"); //} // set the current colours and line style. // set BLACK (normally palette 0) to palette 5 (normally MAGENTA) // to correct a colour setting problem mate to C + + . setpalette(5, BLACK); // activate the mouse to emulate a touch screen. //ActivMouseO; //ShowMouseQ; // construct and initialize buttons. Bunon logo(getmaxx()/2.100.260.130. l,"(AOCI LOGOr."".4, l); Bunon auto_controll(200.400.160.50,2, "AUTO". "CONTROL".2.1); Button manύal control 1 (400,400.160.50.2. "MANUAL ". " CONTROL" ,2, 1 ) . Bunon mute 1(568,440,110.50.1. "MUTE", "",4,1); //Button proceed(getmaxx()/2,440, 160,50, 1 , "PROCEED" , "",4,1); Bunon c_vιsιon(getmaxx()/2,350,450.100,l ."3-D RETRO". "",8.1); Bunon main_menu(245,20.460,30,l."M A I N M E N U"."",2.1); Button tιme_date2(245 ,460.460,30, 1, "Date: Time. Elapsed: " ."",2,1); Button video_screen(245.217.460.345.1,"". "",4,1); Button vιdeo_messagel(245.217,160.50,2. "Video Not","Detected",2.1); Button auto_onoff2(555.20.130.30.2."AUTO CONTROL". "ON / OFF".5.2), Button manual_control2(555,60.130.30,1. "MANUAL CONTROL". " ".5.2); Button name_tags2(555.100.130.30.1. "OBJECT TAGS". "",5.2); Button voιce_tags2(555.140, 130.30.2.-TRIANGULATE/"."DIST. CALCΛ5.2): Button cusιom_sessιon2(555.180.130.30.1. "CUSTOM SESSION". "".5.2); Button memory _tramιng2(555.220, 130.30.1. "MEMORY FRAMING" . " ".5.2); Button remote_commands2(555.260.130.30.2."REMOTE ENDS". "COMMANDS",5.2): Button av_optιons2(555.300.130,30.2."AUDIO/VISUAL"."OPTIONS",5.2), Button codec_control2(555.340.130.30.1. "CODEC CONTROL", "".5.2). Button mcu_control2(555.380.130,30, l,"MCU CONTROL", "",5.2); Button dial connects2(555.420.130,30.2. "DIAL-UP" . "CONNECTIONS " .5.2) ; Bunon mute2(555, 460.130.30,1. "MUTE ","",5, 2); Bunon ιnd_id3(245.20.460.30.1, "PERSONAL IDENTIFICATION " ."",2,1), Bunon frame_cam3(555.20.130.30, 1. "FRAME CAMERA ","",5, 2); Button cam_preset3(555.60, 130,30,1. "CAMERA PRESET". "",5,2); Button autofollow3(555.180,130.30.1."AUTOFOLLOWING". "".5.2): Button return3(555.420.130.30,2."RETURN TO". "LAST MENU".5.2); Button touch face3(130.418.230.35,2."DEFINE AN OBJECT", "AND THEN T0UCH:".5,2): Button rype d3(308.418.105.35,2."ACQUIRE"."OBJECT",5,2); Button wnte_id3(423.418.105.35.2."LOSE","OBJECT",5.2); Button cancel3(555,340.130,30,l, "CANCEL CHOICE", " ",5,2); Button key board(245.375.450.200.1. "(Key board)". "",2,1); Button wπtιng_space(245,425,450, 100,1, "(Writing Space)". "",2,1): Button typing done(555.260.130,30.2, "TYPE AND THEN". "PRESS HERE".5.2); Button writing done(555.260.130,30,2. "WRITE AND THEN", "PRESS HERE",5.2); Button dial connects6(getmaxx()/2.20.604.30,l. "DIAL-UP CONNECTIONS", "",2.1); Button dιrectory6(getmaxx()/2.60.300.30,l. "DIRECTORY". "".2.1); Button manual_dialing6(57.420.84,30.2."MANUAL"."DIALING".5.2): Button hne_16(151.420.84,30,l,"LINE 1 ","".5,2); Button line 26(245.420.84.30.1. "LINE 2". "".5.2); Bunon dial tone6(339.420.84,30.1."DIAL TONE", ",5,2); Bunon hang_up6(433.420.84.30.1."HANG UP". "".5.2); Bunon scroll up6(104.260, 178,30.1. "SCROLL DIRECTORY UP", "",5,2); Bunon scrolfdown6(292.260.178.30.1, "SCROLL DIRECTORY DOWN", "",5.2); Bunon dial this6(198,300.84,30.2."DIAL THIS","NUMBER\5,2); Button add~entry6(104,340.178.30.1, "ADD AN ENTRY ","",5.2); Bunon delete entry6(292.340.178.30.1, "DELETE AN ENTRY". "",5,2); Button keypad6(505.320.230,151,l, "(Keypad)", "",2,1); Page_l: // this is the opening screen. // set the current fill style and draw the background. setfιllstyle(INTERLEAVE_FILL.DARKGRAY): bar3d(0,0,getmaxx(),getmaxy().0,0) logo.upO; c vision.upO; // proceed. up(); // auto comroll.upO; // manual controll.upO; mutel.upO; senextstyle(TRIPLEX FONT. HORIZ_DIR. 2); outtextxy(getmaxx()/27l 0."(C) 1993-1995 AGENTS OF CHANGE INC."); settextstyle(TRIPLEX_FONT. HORIZ_DIR, 4); outtextxy(getmaxx()/2,235, "WELCOME"); outtex«y(getmaxx()/2.265. "TO"); Page_l_flag=TRUE: while (Page l flag) { // temporary keypad substitute for the touch screen. which = getch(); if (which= = T) { if (!c_ vision. ressed) { c_visιon.down(); goto Page_2; } else c vision.upO; } if (which= = '2') { if (! mute 1. pressed) mutel.down(); else mutel.upO; } if (which- = 'S') Page l_flag=FALSE: } goto ρgm_ terminate; Page_2: // this is the ma menu. setfιllstyle(INTERLEAVE_FILL.DARKGRAY); bar3d(0,0,getmaxx(),getmaxy(),0.0); ma menu.upO; video screen.upO; video messagel .down(); tιme_date2.up0; auto onof β .upO; manual_control2.up() ; name_tags2.up(); voιce_tags2.up(); custom_sessιon2.up() ; memory_framιng2.up() ; remote_commands2. up() ; av_optιons2.up(); codec_control2.up() ; mcu_control2.up(); dιal_connects2.up(); mute2.up(); Page_2_flag=TRUE; while (Page 2 flag) { // temporary keypad substitute tor the touch screen. which = getch(); if (which = = ' 1 ') { if (!auto_onoff2.pressed) { auto onoff2.down(); } else auto_onoff2.up(); } if (which = = '2') { if (!manual_comroI2. pressed) manual_control2.down(). else manual_control2.up(). if (which = = '3') { if (!name_tags2. pressed) { name_tags2.down(); goto Page_3; else name_ιags2.up(); } if (which = = '4') { ιf (!voιce tags2.pressed) { voιce_tags2.down(); goto Page_3; } else voιce_tags2.up(); } if (which = = '5') { if (!custom_sessιon2. pressed) custom_sessιon2.down(); else custom_sessιon2.up(); } if (which = = '6') { if (.memory framιng2. pressed) { memory_framιng2.down(); goto Page 3; } else memory _framιng2.up(), } if (which = = '7') { if (!remote_commands2. pressed) remote_commands2.down(); else remote_commands2.up0; } if (which = = '8') { if (!av_optιons2.pressed) av_optιons2.down(): else av_optιons2.up(), } ιf (whιch= = '9') { if (!codec_control2.pressed) codec_control2.down(); else codec comrol2.up(); } if (which = = 'a') { if (!mcu_control2. pressed) mcu_control2.down(): else mcu control2.up(); } if (which = = 'b') { if (!dιal_connects2. pressed) { dιal_connects2. down() , goto Page_6: } else dιal_connects2.up(), } if (whιch= = 'c') { if (!mute2. pressed) mute2.down(); else mute2.up(): } if (which = = ' S ' ) Page_2 flag = FALSE , } goto pgm terminate; Page_3: // this is the first "individual identification" menu. // and includes the step into nametags. setfιllstyle(INTERLEAVE_πLL.DARKGRAY); bar3d(0,0.getmaxx(),getmaxy0,0,0); ind_id3.up(); video screen.upO; video messagel .down(); tιme_date2.up(); frame_cam3.up(); cam_preset3.up(); name_tags2.up(); voιce_tags2.up(); autofollow3.up(); return3.up(); mute2.up(); Page_3_flag=TRUE; while (Page_3_flag) { // temporary keypad substitute for the touch screen. which = getch(); if (which = = T) { if (!frame_cam3. pressed) { f rame_cam3. down() ; } else frame_cam3.up(); } if (which = = '2') { if (!cam_preset3. pressed) cam_preset3.down(); else cam_preseι3.up(); } if (which = = '3') { if (!name_tags2. pressed) { name_tags2.down(): ιouch_face3.up(); type_id3.up(); wrue_ιd3.up(); cancel3.up(); type or wπte: which =getch(); // the cancel button has been pressed. if (which - = '9') goto Page_3; // type nametags. if ( which = = 'x ) goto Page_4; // write nametags. if (which = = y ' ) goto Page_5 : goto type_or_wπte: else name_iags2.up(); if (which= = '4') if (!voice_tags2. pressed) voιce_ gs2.down(); // goto Page_4; else voice tags2.up0; } if (which- - '5') { if (!autofollow3. pressed) autofollow3.down(): // goto Page_4; else autofoilow3.up0; } if (which— = 'b') { if (!return3. pressed) return3.down(); goto Page 2; } else return3.up0; if (which— = 'c') { if (!mute2. pressed) mute2.down(); else mute2.up(); } if (which- = S') Page 3 flag=FALSE: } goto pgm terminate; Page_4: // this is the nametags typing page. setfιllstyle(INTERLEAVE_FILL.DARKGRAY): bar3d(0,0.getmaxx0,getmaxy(),0.0): md_id3.up(): video screen.upO; v ideo essage 1. down( ) ; frame_cam3.up(); cam_preset3.up(); name_tags2.down() ; voιce_tags2.up(); autofollow3.up(); return3.up(); mute2.up(); keyboard. up(); typing done.upO; Page_4_flag=TRUE: while (Page_4_flag) { // temporary keypad substitute for the touch screen. which = getch(); if (which = = '7') { if (Ityping done.pressed) typmg_done.down(); goto Page_3; } else typing done.upO, if (which- 'b') { if (!retuπι3 pressed) return3 down(), goto Page 3, } else return3.up(). if (which- = 'c') { if ('mute2 pressed) mute2.down(), else mute2.up(), if (which- = 'S') Page_4_flag = FALSE } goto pgm terminate. Page_5 // this is the nametags writing page setfillstyle(INTERLEAVE_FILL.DARKGRAY), bar3d(0,0,getmaxx(),getmaxy0,0,0). ιnd_ιd3.up(), video screen.upO, video messagel down(), frame_cam3.up(), cam_preset3.up(), name_tags2. do wn() , voιce_tags2.up(), autofollow3.up(), return3.up0. mute2.up(), wπiing space up(), wrmng_done up() Page_5_flag=TRUE while (Page 5_flag) { // temporary keypad substitute for the touch screen which = getch(), if (which — = '7 ) { if ('lyping done pressed) typmg done down() goto Page_3 } else typmg done up() if (which = = 'b') { if (!return3 pressed) return3.down(), goto Page_3, } else return3.up(), 43 if (which — — c') { if (!mute2.pressed) mute2.down(); else mute2.up(): } if (which - -'S') Page_5_flag- FALSE: } goto pgm terminate; Page_6: // this is the connections dialing and directory maintenance page. setfι!lstyledNTERLEAVE_FILL.DARKGRAY); bar3d(0,0,getmaxx(),getmaxy(),0,0); dial_connecιs6.up(); directory 6. up(); keypadό.upO; scroll upό.upO; scroll downό.upO; dial ihisό.upO; add_entry6.up(); delete_entry6.up(); π nual dialingό.upO; lιne_16.up(); lιne_26.up(); dial toneό.upO; hang upό.upO; return3. up(); mute2.up(); Page_6_flag=TRUE; while (Page 6_flag) { // temporary keypad substitute for the touch screen. which = getch(); if (which— = 'b') { if (!return3. pressed) { return3.down(); goto Page_2; } } else return3.up0; if (which— = 'c') { if (!mute2. pressed) mute2.down(): else mute2.up(); } if (which- = 'S') Page 6_flag=FALSE; } goto pgm terminate: pgm terminate: getchO; this is the closing sequence. closegraphO; } * ARPROCES.H */ /» Image Processing Header File */ » Area Processing Functions */ /* written in Turbo C 2.0 »/ /* Area Process Function Prototypes */ CompletionCode Convolution(BYTE huge 'Inlmage, unsigned Col. unsigned Row. unsigned Width, unsigned Height, short 'Kernel, unsigned KernelCols, unsigned KernelRows. unsigned Scale, unsigned Absolute. BYTE huge * 'OutlmageBufPtr): CompletionCode RealConvolution(BYTE huge 'Inlmage, unsigned Col. unsigned Row, unsigned Width, unsigned Height, double 'Kernel, unsigned KernelCols, unsigned KernelRows. unsigned Scale, unsigned Absolute. BYTE huge * "OutlmageBufPtr): CompletionCode MedianFilter(BYTE huge 'Inlmage. unsigned Col. unsigned Row. unsigned Width, unsigned Height, unsigned NeighborhoodCols. unsigned NeighborhoodRows, BYTE huge * 'OutlmageBufPtr); CompletionCode SobelEdgeDet(BYTE huge 'Inlmage. unsigned Col. unsigned Row. unsigned Width, unsigned Height, unsigned Threshold, unsigned Overlay, BYTE huge * OutlmageBufPtr); » ARPROCES.C */ * Image Processing Code */ * Area Processing Functions •/ * written in Turbo C 2.0 */ ^include <stdio.h> •^include < stdlib.h > <conio.h> #include < dos.h> #include < alloc. h > ^include < process. h > ^include <math.h > #mclude < graphics. h > #include "misc.h" #include "pcx.h" #ιnclude "vga.h" ^include "lmagesup.h" #ιnclude "arprocess.h" /* Integer Convolution Function */ CompletionCode Convolutιon(BYTE huge 'Inlmage, unsigned Col. unsigned Row, unsigned Width, unsigned Height, short 'Kernel, unsigned KernelCols. unsigned KernelRows. unsigned Scale, unsigned Absolute. BYTE huge * OutlmageBufPtr) register unsigned ColExtent. RowExtent: register unsigned ImageCol. ImageRow. KernCol. KernRow: unsigned ColOffset. RowOffset. TempCol. TempRow; BYTE huge OutputlmageBuffer: long Sum: short 'KernelPtr: if (ParameterCheckOK(Col . Row. Col + Width. Row + Height. " Convolution " )) { /* Image must be at least the same size as the kernel "<' if (Width > = KernelCols && Height > = KernelRows) { /* allocate far memory buffer for output image */ OutputlmageBuffer = (BYTE huge *) farcalloc(RASTERSIZE.(unsιgned long)sιzeof(BYTE)); if (OutputlmageBuffer = = NULL) { restorecrtmodeO; pπntfCError Not enough memory for convolution output buffer\n"): return (ENoMemory); } /* Store address of output image buffer */ 'OutlmageBufPtr = OutputlmageBuffer: /* Clearing the output buffer to white will show the boarder areas not touched by the convolution. It also provides a nice white frame for the output image. */ ClearImageArea(OutputImageBuffer.MINCOLNUM.MINROWNUM, MAXCOLS.MAXROWS.WHΓΓE); ColOffset - KernelCols/2; RowOffset = KernelRows/2; /* Compensate for edge effects */ Col + = ColOffset: Row -t- - RowOffset; Width -= OternelCols - 1); Height — (KernelRows - 1); /* Calculate new range of pixels to act upon */ ColExtent = Col + Width; RowExtent = Row + Height; for (ImageRow = Row: ImageRow < RowExtent; ImageRow+ +) { TempRow = ImageRow - RowOffset. for (ImageCol = Col: ImaeeCol < ColExtent: ImageCol + +) { Te pCol = ImageCol - ColOffset; Sum — OL; KernelPtr = Kernel; for (KernCol = 0; KernCol < KernelCols: KernCol + +) for (KemRow = 0; KernRow < KernelRows: KernRow + +) Sum + = (GetPixelFromlmagednlmage, TempCol + KernCol, TempRow + KernRow) * (*KernelPtr+ +)); /* If absolute value is requested */ if (Absolute) Sum — labs(Sum); /* Summation performed. Scale and range Sum*/ Sum > > = (long) Scale, Sum = (Sum < MINSAMPLEVAL) ? MINSAMPLEVAL:Sum. Sum = (Sum > MAXSAMPLEVAL) ? MAXSAMPLEVAL:Sum. PutPιxelInImage(OutputlmageBuffer.ImageCol.ImageRow.(BYTE)Sum). } } } else return(EKernelSιze) ; } return(NoError); } /* Real Number Convolution Function. This convolution function is only used when the kernel entries are floating point numbers instead of integers. Because of the floating point operations envolved. this function is substantially slower than the already slow integer version above. */ CompletionCode RealConvolutionfBYTE huge 'Inlmage, unsigned Col. unsigned Row, unsigned Width, unsigned Height, double 'Kernel, unsigned KernelCols. unsigned KernelRows. unsigned Scale, unsigned Absolute. BYTE huge * OutlmageBufPtr) register unsigned ColExtent, RowExtent; register unsigned ImageCol. ImageRow. KernCol. KernRow; unsigned ColOffset. RowOffset. TempCol, TempRow; BYTE huge 'OutputlmageBuffer; double Sum; double 'KernelPtr; if (ParameterCheckOK(Col.Row.Col + Width.Row-i- Height/Convolution")) { /* Image must be at least the same size as the kernel */ if (Width > = KernelCols && Height > = KernelRows) { /* allocate far memory buffer for output image */ OutputlmageBuffer = (BYTE huge *) farcalloc(RASTERSIZE.(unsιgned long)sιzeof(BYTE)); if (OutputlmageBuffer = = NULL) { restorecrtmodeO; pπntf("Error Not enough memory for convolution output buffer\n"): return (ENoMemory); } /* Store address of output image buffer */ •OutlmageBufPtr = OutputlmageBuffer: /* Clearing the output buffer to white will show the boarder areas not touched by the convolution. It also provides a nice white frame for the output image. */ ClearlmageArea(OutpuιlmageBuffer.MINCOLNUM.MINROWNUM, MAXCOLS.MAXROWS. WHITE), ColOffset = KernelCols/2. RowOffset = Kernel Rows/2: /* Compensate for edge effects */ Col + = ColOffset; Row + = RowOffset; Width -= (KernelCols - 1); Height -= (KernelRows - 1); /* Calculate new range of pixels to act upon */ ColExtent = Col + Width; RowExtent = Row + Height; for (ImageRow = Row; ImageRow < RowExtent: ImageRow + +) { TempRow = ImageRow - RowOffset; for (ImageCol = Col: ImageCol < ColExtent: ImageCol + +) { TempCol = ImageCol - ColOffset; Sum = 0.0; KernelPtr = Kernel; for (KernCol = 0: KernCol < KernelCols: KernCol + +) for (KernRow = 0: KernRow < KernelRows: KernRow + +) Sum + = (GetPixelFromlmagednlmage. TempCol + KernCol. TempRow + KernRow) * (*KernelPtr+ +)); /* If absolute value is requested */ if (Absolute) Sum - fabs(Sum); /* Summation performed. Scale and range Sum */ Sum /- (double)O < < Scale); Sum = (Sum < MINSAMPLEVAL) ? MINSAMPLEVAL:Sum; Sum - (Sum > MAXSAMPLEVAL) ? MAXSAMPLEVAL:Sum; PutPixelInlmage(OutputImageBuffer.lmageCol.ImageRow,(BYTE)Sum); } } } else return (EKernelS ize) ; } return(NoError); /* Byte compare for use with the qsort library function call in the Median filter function. •/ int ByteComparefBYTE 'Entry 1. BYTE *Entry2) { if ('Entry 1 < *Entry2) return(-l); else if ('Entry 1 > 'Entry 2) retum(l); else rerurn(O); } CompletionCode MedιanFιlter(BYTE huge 'Inlmage. unsigned Col. unsigned Row. unsigned Width, unsigned Height, unsigned NeighborhoodCols. unsigned NeighborhoodRows. BYTE huge * OutlmageBufPtr) { register unsigned ColExtent. RowExtent: register unsigned ImageCol. ImageRow. NeighborCol. NeighborRow; unsigned ColOffset. RowOffset. TempCol. TempRow. Pixellndex: unsigned TotalPixels. Medianlndex; BYTE huge 'OutputlmageBuffer; BYTE 'PixelValues; if (ParameterCheckOK(Col.Row.Col+Width.Row+Height."Median Filter")) { /* Image must be at least the same size as the neighborhood */ if (Width > = NeighborhoodCols && Height > = NeighborhoodRows) { /* allocate far memory buffer for output image */ OutputlmageBuffer = (BYTE huge *) farcalloc(RASTERSIZE.(unsιgned long)sιzeof(BYTE)); if (OutputlmageBuffer = = NULL) { restorecrtmodeO; printf("Erτor Not enough memory for median filter output buffer\n"); return (ENoMemory); } /* Store address of output image buffer */ 'OutlmageBufPtr - OutputlmageBuffer: /* Clearing the output buffer to white will show the boarder areas not touched by the median filter. It also provides a nice white frame for the output image. •/ ClearImageArea(OutputlmageBuffer.MINCOLNUM.MINROWNUM. MAXCOLS .MAXROWS , WHITE) ; /* Calculate border pixel to miss */ ColOffset = NeιghborhoodCols/2; RowOffset = NeighborhoodRows/2; /* Compensate for edge effects */ Col + = ColOffset; Row + = RowOffset; Width -= (NeighborhoodCols - 1); Height -= (NeighborhoodRows - 1); /* Calculate new range of pixels to act upon */ ColExtent = Col + Width; RowExtent = Row + Height; TotalPixels = (NeighborhoodCols'NeighborhoodRows); Medianlndex = (NeighborhoodCols*NeιghborhoodRows)/2; /* allocate memory for pixel buffer */ PixelValues = (BYTE • ) calloc(TotalPιxels.(unsιgned)sιzeof(BYTE)); if (PixelValues = = NULL) { restorecrtmodeO; pnntfCError Not enough memory for median filter pixel buffeΛn"). return (ENoMemory); for (ImageRow = Row: ImageRow < RowExtent: ImageRow + + ) { TempRow = ImageRow - RowOffset: for (ImageCol = Col: ImageCol < ColExtent: ImageCol + + ) { TempCol = ImageCol - ColOffset; Pixellndex = 0: for (NeighborCol = 0: NeighborCol < NeighborhoodCols: NeighborCol + + ) for (NeighborRow = 0: NeighborRow < NeighborhoodRows: NeighborRow + + ) PixelValuesfPixellndex + + 1 = GetPixelFromlmagednlmage, TempCol + NeighborCol. TempRow + NeighborRow): /* Quick sort the brightness values into ascending order and then pick out the median or middle value as that for the pixel. */ qsort(PixelValues.TotalPιxels.sιzeof(BYTE).ByteCompare): PutPixelInlmage(OutputlmageBuffer.ImageCol.ImageRow, PixelValues[MedιanIndex]); } } } else return(EKernelSize) ; } free(Pιxel Values); /* give up the pixel value buffer */ return(NoError); } /* Sobel Edge Detection Function */ CompletionCode SobelEdgeDet(BYTE huge 'Inlmage, unsigned Col. unsigned Row. unsigned Width, unsigned Height, unsigned Threshold, unsigned Overlay, BYTE huge • OutlmageBufPtr) register unsigned ColExtent. RowExtent: register unsigned ImageCol. ImageRow: unsigned PtA. PtB. PtC. PtD, PtE. PtF. PtG, PtH. PtI: unsigned LineAEIAveAbove, LineAEIAveBelow. LineAEIMaxDif; unsigned LineBEHAveAbove. LineBEHAveBelow. LineBEHMaxDif; unsigned LineCEGAveAbove, LineCEGAveBelow, LineCEGMaxDif; unsigned LineDEFAveAbove. LineDEFAveBelow, LineDEFMaxDif; unsigned MaxDif; BYTE huge 'OuφutlmageBuffer: if (ParameterCheckOK(Col,Row,Col+Width.Row + Heιght. "Sobel Edge Detector")) { /* allocate far memory buffer for output image */ OuφutlmageBuffer = (BYTE huge *) farcalloc(RASTERSIZE.(unsιgned longιsιzeof(BYTE)); if (OutputlmageBuffer = = NULL) { restorecrtmodeO; prιntf("Error Not enough memory for Sobel output buffe n"): return (ENoMemory); } /* Store address of output image buffer */ 'OutlmageBufPtr = OutputlmageBuffer: /* Clearing the output buffer */ Clearlmage Area(OutputImageBuffer.MINCOLNUM .MINROWNUM . MAXCOLS.MAXROWS .BLACK) ; /* Compensate for edge effects of 3x3 pixel neighborhood */ Col + = 1; Row + = 1; Width -= 2; Height -= 2; /* Calculate new range of pixels to act upon */ ColExtent = Col + Width. RowExtent - Row + Height, for (ImageRow = Row; ImageRow < RowExtent. ImageRow + ■ +) for (ImageCol = Col, ImageCol < ColExtent. ImageCol + +) { /* Get each pixel in 3x3 neighborhood */ PtA - GetPιxelFromImage(Inlmage,ImageCol-l.ImageRow-l), PtB = GetPixelFromlmagednlmage.ImageCol .ImageRow-1), PtC - GetPιxelFromImage(InImage.ImageCoI+ 1. ImageRow- 1) PtD = GetPixelFromlmagednlmage. ImageCol- 1. ImageRow ) PtE - GetPixelFromlmagednlmage, ImageCol .ImageRow ), PtF — GetPixelFromlmagednlmage. ImageCol + 1. ImageRow ), PtG = GetPixelFromimagednlmage.lmageCol-l. ImageRow - 1). PtH = GetPixelFromlmagednlmage. ImageCol . ImageRow + 1) PtI = GetPixelFromlmagednlmage, ImageCol + 1. ImageRow + 1) /* Calculate average above and below the line Take the absolute value of the difference */ LineAElAveBelow = (PtD + PiG + PtH)/3 LineAElAveAbove = (PtB+PtC + PtF)/3, LmeAEIMaxDif = abs(Lιne,AEIAveBelow-LιneAEIAveAbove) LineBEHAveBelow = (PtA + PtD+PtG)/3, LineBEHAveAbove = (PtC + PtF+PtI)/3. LineBEHMaxDif = abs(LιneBEHAveBelow-LιneBEHAveAbove). LineCEGAveBelow = (PtF+PtH+PtI)/3, LineCEGAveAbove = (PtA+PtB+PtD)/3. LineCEGMaxDif = abs(LιneCEGAveBelow-LιneCEGAveAbove), LineDEFAveBelow = (PtG+PtH+PtI)/3. LmeDEFAveAbove = (PtA + PtB + PtC)/3, LmeDEFMaxDif = abs(LιneDEFAveBelow-LmeDEFAveAbove). /' Find the maximum value of the absolute differences from the tour possibilities */ MaxDif = MAX(LmeAEIMaxDιf.LιneBEHMaxDιf) MaxDif = MAX(LιneCEGMaxDιf.MaxDιf). MaxDif = MAX(LιneDEFMaxDιf.MaxDιf). /* If maximum difference is above the threshold, set the pixel of interest (center pixel) to white If below the threshold optionally copy the input image to the output image This copying is controlled by the parameter Overlay */ if (MaxDif > = Threshold) PutPιxelInlmage(OutputlmageBuffer ImageCol. ImageRow WHITE) else if (Overlay) PutPιxelInlmage(OutputImageBuffer.ImageCol.ImaεeRow PtE), } } return(NoError), } /* FRPOCES.H */ /* Image Processing Header File */ /* Frame Processing Functions */ /* written in Turbo C 2.0 */ /•*•*••*•••••••»»••***••*«* • *•»•*•• • •••••/ /* User defined image combination type */ typedef enum { And.Or.Xor.Add.Sub.Mult.Div.Min.Max.Ave, Overlay} BitFunction: /* Frame Process Function Prototypes */ void CombinelmagesfBYTE huge 'SImage, unsigned SCol. unsigned SRow. unsigned SWidth. unsigned SHeight. BYTE huge 'DImage, unsigned DCol. unsigned DRow, enum BitFunction CombineType, short Scale); .ft*************************************** - * FPROCES.C */ * Image Processing Code */ * Frame Process Functions */ * written in Turbo C 2.0 */ <stdιo.h> <stdlib.h> #ιnclude <como.h> #ιnclude <alloc.h> < process. h> < graphics. h > #ιnclude "misc.h" "imagesup.h" #ιnciude "fφrocess.h" /* Single function performs ail image combinations */ void CombιneImages(BYTE huge 'SImage, unsigned SCol. unsigned SRow, unsigned SWidth. unsigned SHeight, BYTE huge 'DImage. unsigned DCol. unsigned DRow, enum BitFunction CombineType, short Scale) { register unsigned SImageCol. SlmageRow. DestCol, short SData. DData: unsigned SColExtem. SRowExtent; if (ParameterCheckOK(SCol.SRow.SCol + SWιdth.SRow + SHeιght."CombιneImages") && ParameterCheckOK(DCol . DRow .DCol + S W idlh. DRow + SHeight . " Combinelmages " )) { SColExtem = SCol +SWidth: SRowExtent = SRow + SHeight; for (SlmageRow = SRow: SlmageRow < SRowExtem: SImageRow+ +) { /* Reset the destination Column coum every row */ DestCol = DCol; for (SImageCol = SCol: SImageCol < SColExtem: SImageCol + + ) { /* Get a byte of the source and dest image data */ SData = GetPιxelFromΙmage(SImage.SImageCol.SImageRow). DData = GetPιxelFromImage(DImage.DestCol,DRow); /* Combine source and dest data according to parameter */ swιtch(CombιneType) { case And: DData &= SData; break; case Or: DData | = SData. break; case Xor: DData * = SData: break; case Add: DDau + = SData; break; case Sub: DDau -- SDau; break; case Mult: DDau *= SDau; break; case Div: if (SDau i - O) DDau /= SDau; break; case Min: DDau = MIN(SDau.DDau); break; case Max: DDau = MAX(SDau.DDau): break; case Ave: DDau = (SDau+DDau)/2; break; case Overlay: DData - SDau: break; } /* Scale the resulunt dau if requested to. A positive Scale value shifts the destination dau to the right thereby dividing it by a power of two. A zero Scale value leaves the dau untouched. A negative Scale value shifts the dau left thereby multiplying it by a power of two. */ if (Scale < 0) DDau < < = abs(Scale): else if (Scale > 0) DDau > > = Scale: /* Don't let the pixel dau get out ot range */ DDau = (DDau < MINSAMPLEVAL) ? MINSAMPLEVAL:DDau: DDau = (DDau > MAXSAMPLEVAL) ? MAXSAMPLEVAL:DDau: PutPιxeiInImage(Dlmage.DestCoi + + .DRow.DDau) } /* Bump to next row in the destination image */ DRow + + ; } } } /* GEPROCES.H •/ /* Image Processing Header File */ /* Geometric Processing Functions */ /* written in Turbo C 2.0 */ /* Misc user defined types */ typedef enum {HorizMirror.VertMirror} MirrorType; /* Geometric processes function prototypes */ void ScaleImage(BYTE huge 'Inlmage. unsigned SCol. unsigned SRow, unsigned SWidth. unsigned SHeight, double ScaleH. double Scale V, BYTE huge Outlmage, unsigned DCol. unsigned DRow, unsigned Interpolate); void SizeImage(BYTE huge 'Inlmage. unsigned SCol. unsigned SRow. unsigned SWidth. unsigned SHeight, BYTE huge 'Outlmage. unsigned DCol. unsigned DRow. unsigned DWidth. unsigned DHeight. unsigned Interpolate); void RouteImage(BYT£ huge 'Inlmage, unsigned Col. unsigned Row, unsigned Width, unsigned Height, double Angle, BYTE huge 'Outlmage. unsigned Interpolate); void TranslateImage(BYTE huge 'Inlmage, unsigned SCol. unsigned SRow, unsigned SWidth. unsigned SHeight. BYTE huge Outlmage, unsigned DCol. unsigned DRow, unsigned EraseFlag); void MιrrorImage(BYTE huge 'Inlmage, unsigned SCol. unsigned SRow. unsigned SWidth. unsigned SHeight. enum MirrorType WhichMirror, BYTE huge 'Outlmage. unsigned DCol. unsigned DRow); **************************************** j GEPROCES.C » / Image Processing Code */ Geometric Processing Functions */ * written in Turbo C 2.0 •/ #include <stdio.h> ^include <conio.h> #include <dos.h> #include < alloc. h> ^include < process. h> #include < graphics. h> #include "misc.h" ^include "pcx.h" ^include "vga.h" ^include "imagesup.h" void ScaleImage(BYTE huge 'Inlmage, unsigned SCol. unsigned SRow, unsigned SWidth. unsigned SHeight, double ScaleH. double Scale V. BYTE huge 'Outlmage. unsigned DCol. unsigned DRow. unsigned interpolate) unsigned DestWidth. DestHeight; unsigned PtA. PtB. PtC, PtD, PixelValue: register unsigned SPixelColNum, SPixelRowNum. DestCol. DestRow double SPixelColAddr. SPixelRowAddr; double ColDelu. RowDelu; double ComribFromAandB. ContribFromCandD; DestWidth = ScaleH * SWidth + 0.5; DestHeight = ScaleV * SHeιght+ 0.5; if (ParameterCheckOK(SCol.SRow.SCol+SWidth.SRow+SHeight."ScaleImage") && ParameterCheckOK(DCol.DRow.DCol +DestWidth.DRow + DestHeieht. "Scalelmage")) { /* Calculations from destination perspective */ for (DestRow = 0: DestRow < DestHeight; DestRow + + ) { SPixelRowAddr = DestRow/ScaleV: SPixelRowNum = (unsigned) SPixelRowAddr; RowDelu - SPixelRowAddr - SPixelRowNum; SPixelRowNum + = SRow; for (DestCol = 0: DestCol < DestWidth: DestCol + +) { SPixelColAddr = DestCol/ScaleH: SPixelColNum = (unsigned) SPixelColAddr: ColDelu = SPixelColAddr - SPixelColNum. SPixelColNum + = SCol; if (Interpolate) { /* SPixelColNum and SPixelRowNum now comain the pixel coordinates of die upper left pixel of the urgetted pixel's (point X) neighborhood. This is point A below: A B X C D We must retrieve the brightness level of each of the four pixels to calculate the value of the pixel put into the destination image. Get point A brightness as it will always lie within the input image area. Check to make sure the other points are within also. If so use their values for the calculations. If not, set them all equal to point A s value. This induces an error but only at the edges on an image */ PtA = GetPιxelFromΙmage(InΙmage.SPιxelColNum.SPιxelRowNum), if (((SPixelColNum + 1 ) < MAXCOLS) && ((SPιxelRowNum+ 1 ) < MAXROWS)) { PtB = GeiPιxelFromImage(Inlmage.SPιxelColNum+ l . SPixelRowNum), PtC = GetPixelFromlmagednlmage. SPιxelColNum.SPιxelRowNum+ 1). PtD = GetPιxelFromImage(InImage,SPιxelColNum+ l .SPιxelRowNum+ l), } else { /* All points have equal brightness */ PtB -PtC -PtD -PtA, } /* Interpolate to find brightness contribution of each pixel in neighborhood. Done in both the horizontal and vertical directions */ ContπbFromAandB = ColDelu*((double)PtB - PtA) + PtA, ContπbFromCandD = ColDelu*((double)PtD - PtC) + PtC, PixelValue = 0.5 + ContπbFromAandB + (ContπbFromCandD - ContπbFromAandB)*RowDeiu. } else PixelValue -GetPixelFromlmagednlmage. SPixelColNum. SPixelRowNum). /* Put the pixel into the destination buffer */ PutPιxelInImage(Outlmage.DestCol + DCol.DestRow + DRow PixelValue) } } } void SιzeImage(BYTE huge 'Inlmage. unsigned SCol. unsigned SRow unsigned SWidth. unsigned SHeight, BYTE huge Outlmage, unsigned DCol. unsigned DRow. unsigned DWidth. unsigned DHeight. unsigned Interpolate) { double HScale. VScale: /* Check for parameters out of range */ if (ParameterCheckOK(SCol.SRow.SCol + SWιdth.SRow + SHeιght. "Sizelmage") && ParameterCheckOK(DCol .DRo . DCol + DWidth . DRo + DHeight , "Sizelmage " )) { /* Calculate horizontal and vertical scale factors required to fit specified portion of input image into specified portion of output image. */ 59 HScale - (double)DWιdth/(double)SWιdth; VScale - (double)DHeιght (double)SHeight; /* Call Scalelmage to do the actual work */ Scalelmagednlmage.SCol.SRow.SWidth.SHeight.HScale. VScale. Outlmage.DCol.DRow. Interpolate); } void RouteImage(BYTE huge 'Inlmage, unsigned Col. unsigned Row, unsigned Width, unsigned Height, double Angle, BYTE huge Outlmage. unsigned Interpolate) { register unsigned ImageCol. ImageRow: unsigned CenterCol, CenterRow. SPixelColNum. SPixelRowNum; unsigned ColExtent. RowExtent. PixelValue: unsigned PtA. PtB, PtC. PtD; double DPixelRelativeColNum. DPixelRelativeRowNum; double CosAngle. SinAngle, SPixelColAddr, SPixelRowAddr: double ColDelu, RowDelu; double ContπbFromAandB. ContribFromCandD: if (ParameterCheckOK(Col.Row.Col+Wιdth.Row + Heιght,"RouteImage")) { /* Angle must be in 0..359.9 */ while (Angle > = 360.0) Angle — 360.0; /* Convert angle from degrees to radians */ Angle *= ((double) 3.14159/(double) 180.0); /* Calculate angle values for roution */ CosAngle = cos( Angle); SinAngle — sm( Angle), /* Center of roution */ CenterCol = Col + Width/2. CenterRow = Row + Height/2, ColExtent = Col + Width. RowExtent — Row + Height. /* All -calculations are performed from the destination image perspective. Absolute pixel values must be converted into inches of display disunce to keep the aspect value correct when image is routed. After roution. the calculated display disunce is converted back to real pixel values. */ for (ImageRow = Row: ImageRow < RowExtent: ImageRow + + ) { DPixelRelativeRowNum = (doubleUmageRow - CenterRow: /* Convert row value to display disunce from image center */ DPixelRelativeRowNum *- LRINCHESPERPDCELVERT: for (ImageCol = Col: ImageCol < ColExtent: ImageCol + +) { DPixelRelativeColNum = (double)ImageCol - CenterCol; /* Convert col value to display disunce from image center */ DPixelRelativeColNum *= LRINCHESPERPD ELHORIZ: /* Calculate source pixel address from destination pixels position. •/ SPixelColAddr = DPixelRelativeColNum 'CosAngle- DPixelRelativeRowNum'SmAngle; SPixelRowAddr = DPιxelRelatιveColNum*SmAngle+ DPixelRelativeRowNum'CosAngle; /* Conveπ from coordinates relative to image center back into absolute coordinates */ /* Convert display distance to pixel location */ SPixelColAddr • = LRPDCELSPERINCHHORIZ, SPixelColAddr + = CenterCol; SPixelRowAddr *= LRPDCELSPERINCHVERT. SPixelRowAddr + = CenterRow, SPixelColNum = (unsigned) SPixelColAddr. SPixelRowNum — (unsigned) SPixelRowAddr, ColDelu = SPixelColAddr - SPixelColNum. RowDelu = SPixelRowAddr - SPixelRowNum, if (Interpolate) { /* SPixelColNum and SPixelRowNum now conuin the pixel coordinates of the upper left pixel of the urgetted pixel's (point X) neighborhood This is point A below A B X C D We must retrieve the brightness level of each of the four pixels to calculate the value of the pixel put into the destination image Get point A brightness as it will alwavs e within the input image area Check to make sure the other points are within also If so use their values for the calculations If not. set them all equal 10 point A s value This induces an error but onlv at the edges on an image */ PtA = GetPιxelFromΙmage(InΙmage.SPιxelColNum.SPιxelRowNum). if (((SPixelColNum + 1) < MAXCOLS) && ((SPιxelRowNum+ 1) < MAXROWS)) { PtB = GetPιxelFromImage(InImage,SPιxelColNum + l . SPixelRowNum), PtC = GetPιxelFromImage(InImage.SPιxelColNum,SPιxelRowNum+ l), PtD = GetPιxelFromImage(InImage.SPιxelColNum+ l .SPιxelRowNum+ l). } else { /* All points have equal brightness */ PtB = PtC = PtD = PtA, } /* Interpolate to find brightness contribution ol each pixel in neighborhood. Done in both the horizontal and veπical directions. */ ContribFromAandB = ColDelU*((double)PtB - PtA) + PtA, ContπbFromCandD = CoIDelu'((double)PtD - PtC) + PtC. PixelValue = 0 5 + ContribFromAandB + (ContπbFromCandD - ContribFromAandB) 'RowDelu, } else PixelValue=GetPixelFromImage(InImage. SPixelColNum. SPixelRowNum); I* Put the pixel into the destination buffer */ PutPixelInImage(Outlmage,ImageCol, ImageRow. PixelValue); } } } } / ♦ Caution: images must not overlap •/ void TransiateImage(BYTE huge 'Inlmage, unsigned SCol. unsigned SRow. unsigned SWidth. unsigned SHeight, BYTE huge 'Outlmage, unsigned DCol. unsigned DRow, unsigned EraseFlag) { register unsigned SImageCol. SlmageRow. DestCol: unsigned SColExtem. SRowExtent; /* Check for parameters out of range */ if (ParameterCheckOK(SCol. SRow. SCol -t-SWidth, SRo +SHeιght. "Translatelmage ") && ParameterCheckOK(DCol.DRow .DCol + SWidth.DRow + SHeight, "Translatelmage")) { SColExtem = SCol + SWidth; SRowExtent - SRow+SHeight; for (SlmageRow = SRow; SlmageRow < SRowExtent: SImageRow+ +) { /* Reset the destination Column count every row */ DestCol = DCol: for (SImageCol = SCol; SImageCol < SColExtem: SImageCol + + ) { /* Transfer byte of the image dau between buffers */ PutPixellnlmage(Outlmage.DestCo) + + .DRow. GetPixelFromlmagednlmage. SImageCol. SlmaeeRow)), } /* Bump to next row in the destination image */ DRow + + ; } /* If erasure specified, blot out original image */ if (EraseFlag) ClearlmageAreadnlmage. SCol. SRow. SWidth. SHeighi.BLACK); } } void MirrorImage(BYTE huge 'Inlmage, unsigned SCol. unsigned SRow. unsigned SWidth. unsigned SHeight, enum MirrorType WhichMirror, BYTE huge Outlmage, unsigned DCol. unsigned DRow) { register unsigned SImageCol. SlmageRow. DestCol; unsigned SColExtem. SRowExtent; /* Check for parameters out of range */ if (ParameterCheckOK(SCol.SRow.SCol+SWidth.SRow+SHeight."MirrorImage") && ParameterCheckOK(DCol.DRow.DCol+SWιdth.DRow+SHeιght,"MιrrorImage")) SColExtem - SCol + SWidth; SRowExtent = SRow + SHeight; swιtch(WhichMnτor) { case HorizMirror: for (SlmageRow = SRow: SlmageRow < SRowExtent: SlmageRow + + ) { /* Reset the destination Column count every row */ DestCol = DCol + SWidth: for (SImageCol = SCol: SImageCol < SColExtem: SImageCol + + ) { /* Transfer byte of the image dau between buffers */ PutPιxelInlmage(OutImage. -DestCol. DRow, GetPixelFromlmagednlmage. SImageCol. SlmaeeRow)) } /* Bump to next row in the destination image */ DRow+ + ; } break: case VertMirror: DRow + = (SHeight- 1), for (SlmageRow = SRow; SlmageRow < SRowExtem: SImaeeRow + + ) { /* Reset the destination Column count every row */ DestCol = DCol; for (SImageCol = SCol: SImageCol < SColExtem: SImageCol + +) { /* Transfer byte of the image dau between buffers */ PutPιxelInImage(OutImage,DestCol + + .DRow. GetPixelFromlmagednlmage. SImageCol. SlmageRow)); } /* Bump to next row in the destination image */ DRow-: } break: ,****,**.***.**************************»./ /* IMAGESUP.H */ /* Image Processing Header File */ /* Image Processing Support Functions */ /* written in Turbo C 2.0 */ I****************************************/ /* This file includes the general equates used for all of the image processing code in part two of this book. Throughout these equates, a 320x200256 color image is assumed. If the resolution of the processed pictures change, the equates MAXCOLS and MAXROWS must change accordingly. */ /* Pixel Sample Information and Equates */ #defme MAXSAMPLEBITS 6 /* 6 bits from digitizer */ #define MINSAMPLEVAL 0 /* Min sample value = 0 » / /* Max num of sample values */ Λiefine MAXQUANTLEVELS (1 < < MAXSAMPLEBITS) /* Max sample value - 63 */ Λtefine MAXSAMPLEVAL (MAXQUANTLEVELS- 1 ) /* Image Resolution Equates */ #defιne MINCOLNUM 0 /• Column 0 */ ftlefine MAXCOLS LRMAXCOLS /* 320 toul columns */ #define MAXCOLNUM (MAXCOLS- 1 ) /* Last column is 319 */ ^define MINROWNUM 0 /* Row 0 */ iCdefine MAXROWS LRMAXROWS /* 200 toul rows */ Λlefine MAXROWNUM (MAXROWS- 1) /* Last row is 199 */ #define RASTERSIZE ((long)MAXCOLS * MAXROWS) ftøefine MAXNUMGRAYCOLORS MAXQUANTLEVELS /* histogram equates */ Mefine HISTOCOL 0 Λlefine HISTOROW 0 #defιne HISTOWIDTH 134 #defιne HISTOHEIGHT 84 #define BLACK 0 #define WHITE 63 Λiefine AXISCOL (HISTOCOL +3) Λiefine AXISROW (HISTOROW +HISTOHEIGHT-5) #defme AXISLENGTH MAXQUANTLEVELS *2-l #defιne DATACOL AXISCOL (Cdefine DATAROW AXISROW- 1 ■ define MAXDEFLECTION OHSTOHEIGHT-10) /* External Function Declarations and Prototypes */ void Copylmage(BYTE huge 'SourceBuf, BYTE huge 'DestBuf); BYTE GetPixelFromlmage(BYTE huge 'Image, unsigned Col. unsigned Row); CompletionCode PutPixelInImage(BYTE huge 'Image, unsigned Col. unsigned Row. unsigned Color); CompletionCode DrawHLine(BYTE huge 'Image, unsigned Col. unsigned Row, unsigned Length, unsigned Color); CompletionCode DrawVLine(BYTE huge 'Image, unsigned Col. unsigned Row. unsigned Length, unsigned Color); void ReadlmageAreaToBuf (BYTE huge 'Image, unsigned Col. unsigned Row, unsigned Width, unsigned Height, BYTE huge 'Buffer); void WritelmageAreaFromBuf (BYTE huge 'Buffer, unsigned BufWidth, unsigned BufHeight, BYTE huge 'Image, unsigned ImageCol. unsigned ImageRow); void ClearlmageArea(BYTE huge 'Image.unsigned Col. unsigned Row, unsigned Width, unsigned Height, unsigned PixelValue); CompletionCode ParameterCheckOK(unsιgned Col. unsigned Row, unsigned ColExtent. unsigned RowExtent, char ΕrrorStr); /• IMAGESUP.C » / /* Image Processing Support Functions */ / » written in Turbo C 2.0 */ ^include <stdio.h> ^include <process.h > ^include <conio.h> ^include <dos.h> #include < alloc. h> ^include <mem.h> ^include < graphics. h> #include "misc.h" #include "pcx.h" #ιnclude "vga.h" ^include "imagesup.h" extern struct PCX File PCXDau; extern unsigned ImageWidth; extern unsigned ImageHeight; /* Image Processing Support Functions - See text for deuils. */ /* Copy a complete image from source buffer to destination buffer •/ void CopyImage(BYTE huge 'SourceBuf. BYTE huge 'DestBuf) { movedau(FP_SEG(SourceBuf).FP_OFF(SourceBuf), FP~ SEG(DestBuf) .FP_OFF(DestBuf) . (unsigned) RASTERSIZE); } /* NOTE: to index into the image memory like an array, the index value must be a long variable type. NOT just cast to long. */ BYTE GetPixelFromImage(BYTE huge 'Image, unsiened Col. unsigned Row) { unsigned long PixelBufOffset: if((Col < ImageWidth) && (Row < ImageHeight)) { PixelBufOffset = Row; /* done to prevent overflow */ PixelBufOffset *= ImageWidth; PixelBufOffset + = Col; rerurndmage[PixelBufOff set]) ; } printfCGetPixelFromlmage Error: Coordinate out of range\n"); printfC Col = %d Row = %d\n",Col.Row); return(FALSE); } CompletionCode PutPixellnImage(BYTE huge 'Image, unsigned Col, unsigned Row. unsigned Color) unsigned long PixelBufOffset; if((Col < ImageWidth) && (Row < ImageHeight)) { PixelBufOffset = Row; /* done to prevent overflow */ PixelBufOffset *= ImageWidth; PixelBufOffset + = Col: ImagefPixelBufOffset] = Color; return(TRUE); } else { printfCPutPixellnlmage Error: Coordinate out of range\n"): printfC Col = %d Row = %d\n".Col.Row); return(FALSE); } } / » NOTE: A length of 0 is one pixel on. A length of 1 is two pixels on. That is why length is incremented before being used. •/ CompletionCode DrawHLinefBYTE huge 'Image, unsigned Col. unsigned Row. unsigned Length, unsigned Color) { if ((Col < ImageWidth) && ((Col + Length) < = ImageWidth) && (Row < ImageHeight)) { Length + + : while(Length— ) PutPixelInlmage(Image,Col + + .Row, Color); return(TRUE); } else { pπntf(" DrawHLine Error: Coordinate out of range\n"); printfC Col = %d Row = %d Length = %d\n" . Col. Row. Length): return(FALSE); CompletionCode DrawVLine(BYTE huge 'Image, unsigned Col. unsigned Row. unsigned Length, unsigned Color) { if ((Row < ImageHeight) && ((Row + Length) < = ImageHeight) && (Col < ImageWidth)) { Length + + ; while(Length-) PutPixellnlmagedmage.Col. Row + + .Color); return(TRUE); } else { printf("DrawVLine Error: Coordinate out of range\π"); printfC Col = %d Row = %d Length = %d\n".Col.Row.Length): return(FALSE); } } void ReadlmageAreaToBuf (BYTE huge 'Image, unsigned Col, unsigned Row. 67 unsigned Width, unsigned Height, BYTE huge 'Buffer) { unsigned long PixelBufOffset - OL; register unsigned ImageCol. ImageRow; for (ImageRow -Row: ImageRow < Row -(-Height; ImageRow + + ) for (ImageCol -Col; ImageCol < Col + Width: ImageCol + +) Buffer[PixelBufOffset+ +] - GetPixelFromlmage(Image, ImageCol. ImageRow); } void WritelmageAreaFromBuf (BYTE huge 'Buffer, unsigned BufWidth, unsigned BufHeight. BYTE huge 'Image, unsigned ImageCol. unsigned ImageRow) { unsigned long PixelBufOffset: register unsigned BufCol. BufRow. CurremlmageCol; for (BufRow = 0: BufRow < BufHeight; BufRow+ +) { CurremlmageCol - ImageCol: for (BufCol = 0: BufCol < BufWidth: BufCol + +) { PixelBufOffset = (unsigned long)BufRow*BufWidth+ BufCol: PutPixelInImage(Image, CurremlmageCol. ImageRow. Buffer[PιxelBufOffset]); CurremlmageCol + + ; } ImageRow+ + ; } } void ClearImageArea(BYTE huge 'Image. unsigned Col. unsigned Row. unsigned Width, unsigned Height, unsigned PixelValue) { register unsigned BufCol. BufRow: for (BufRow = 0: BufRow < Height: BufRow + +) for (BufCol = 0: BufCol < Width: BufCol + +) PutPixellnlmagedmage.BufCol+Col.BufRow+Row. PixelValue); /* This function checks to make sure the parameters passed to the image processing functions are all within range. If so a TRUE is returned. If not. an error message is output and the calling program is terminated. */ CompletionCode ParameterCheckOK(unsιgned Col. unsigned Row, unsigned ColExtent. unsigned RowExtent. char 'FunctionName) { if ((Col > MAXCOLNUM) 1 1 (Row ■ > MAXROWNUM) 1 1 (ColExtent > MAXCOLS) 1 1 (RowExtent > MAXROWS)) { restorecrtmodeO; pπntfCParameter(s) out of range in function: %s\n". FunctionName); printfC Col = %d Row = %d ColExtent = %d RowExtent = %d\n". Col. Row. ColExtent. RowExtent); exit(EBadParms); } returniTRUE); PTPROCES.H */ * Image Processing Header File •/ /» Point Processing Functions */ /* written in Turbo C 2.0 */ extern unsigned HistogramfMAXQUANTLEVELS); /* Function Prototypes for support and histogram functions */ void InitializeLUT(BYTE 'LookUpTable); void PtTransform(BYTE huge 'ImageDau. unsigned Col, unsigned Row, unsigned Width, unsigned Height. BYTE 'LookUpTable); void GenHistogram(BYTE huge 'ImageDau. unsigned Col, unsigned Row, unsigned Width, unsigned Height); void DιsplayHist(BYTE huge 'ImageDau. unsigned Col. unsigned Row. unsigned Width, unsigned Height); /* Point transform functions */ void AdjImageBrightness(BYTE huge 'ImageDau. short BrighmessFactor. unsigned Col. unsigned Row, unsigned Width, unsigned Height); void Negaιeimage(BYTE huge 'ImageDau. unsigned Threshold, unsigned Col. unsigned Row, unsigned Width, unsigned Height); void ThresholdImage(BYTE huge 'ImageDau. unsigned Threshold, unsigned Col. unsigned Row, unsigned Width, unsigned Height): void StretchImageContrast(BYTE huge 'ImageDau. unsigned 'HistoData. unsigned Threshold, unsigned Col. unsigned Row. unsigned Width, unsiened Height): ,**,******.* * **** * *** *** .** * .**...* * . * *.,, /* PTPROCES.C */ /* Image Processing Code */ /* Point Process Functions */ /* written in Turbo C 2.0 */ /••••••*••*•*•••*•■****•••••••**••*•*«••*/ ^include <stdio.h > ^include < stdiib.h > #include <como.h > ^include <dos.h > #include < alloc. h > ^include < process. h > ^include < graphics. h> ^include "misc.h" ^include "pcx.h" inc u e imagesup.h" /* Histogram storage location */ unsigned HistogramfMAXQUANTLEVELS]; /* Look Up Table (LUT) Functions Initialize the Look Up Table (LUT) for straight through mapping. If a point transform is performed on an initialized LUT. output dau will equal input data. This function is usually called in preparation for modification to a LUT. */ void InιtιalιzeLUT(BYTE 'LookUpTable) { register unsigned Index: for (Index = 0: Index < MAXQUANTLEVELS: Index+ + ) LookUpTableflndex] = Index; } /* This function performs a point transform on the portion of the image specified by Col. Row. Width and Height. The actual transform is conuined in the Look Up Table who address is passed as a parameter. */ void PtTransform(BY1Ε huge 'ImageDau. unsigned Col. unsigned Row, unsigned Width, unsigned Height. BYTE 'LookUpTable) { register unsigned ImageCol. ImageRow: register unsigned ColExtent. RowExtent; ColExtent = Col + Width: RowExtent - Row+ Height; if (ParameterCheckOK(Col,Row.ColExtent.RowExtent, "PtTransform")) for (ImageRow-Row: ImageRow < RowExtent; ImageRo 4- +) for (ImageCol -Col: ImageCol < ColExtent: ImageCol ++) PutPixellnlmagedmageDau.ImageCol. ImageRow, LookUpTable[GetPixelFromlmage(ImageDau.lmageCol, ImageRow)]); } /* start of histogram functions This function calculates the histogram of any portion of an image. •/ void GenHistogramCBYTE huge 'ImageDau. unsigned Col. unsigned Row, unsigned Width, unsigned Height) { register unsigned ImageRow. ImageCol. RowExtent. ColExtent, register unsigned Index; /* clear the histogram array */ for (lndex=0: Index < MAXQUANTLEVELS: Index+ +) Hιstogram(Index) - 0. RowExtent = Row+Height; ColExtent = Col + Width; if (ParameterCheckOK(Col.Row,ColExtent.RowExtent. "GenHistogram")) { /* calculate the histogram */ for (ImageRow = Row; ImageRow < RowExtent: ImageRow + +) for (ImageCol = Col: ImageCol < ColExtent: ImageCol + +) Hιstogram[GetPιxelFromImage(ImageDau. ImageCol. ImageRow)] + = 1 ; } } This function calculates and displays the histogram ot an image or partial image. When called it assumes the VGA is already in mode 13 hex. */ void DisplayHistfBYTE huge 'ImageDau. unsigned Col. unsigned Row, unsigned Width, unsigned Height) { BYTE huge 'Buffer. register unsigned Index. LineLength. XPos. YPos: unsigned MaxRepeat: /* Allocate enough memorv to save image under histogram */ Buffer - (BYTE huge *) farcalloc((long)HISTOWIDTH*HISTOHEIGHT.sιzeof(BYTE)); if (Buffer - = NULL) { printfC No buffer memory\n"); exιt(ENoMemory ) ; } /* Save a copy of the image */ ReadImageAreaToBufdmageDau,HISTOCOL.HISTOROW,HISTOWIDTH.HISTOHEIGHT. Buffer); /* Set VGA color register 65 to red. 66 to green and 67 to blue so the histogram can be visually separated from the continuous tone image. */ SetAColorReg(65.63,0,0) SetAColorReg(66,0.63,0) SetAColorReg(67,0,0,63) /* Calculate the histogram for the image */ GenHistogramdmageDau, Col. Row. Width. Height); MaxRepeat = 0; /* Find the pixel value repeated the most. It will be used for scaling. */ for (Index =0: Index < MAXQUANTLEVELS: Index + + ) MaxRepeat = (Histogramflndex] > MaxRepeat) ? Histogramflndex] :MaxRepeat: /* Fill background area of histogram graph */ ClearImageArea(ImageDau.HISTOCOL.HISTOROW.HISTOWIDTH.HISTOHEIGHT,67); /* Draw the bounding box for the histogram */ DrawVLine(ImageDau.HISTOCOL.HISTOROW.HISTOHEIGHT-l.BLACK); Draw VLinedmageDau.HISTOCOL + HISTOWIDTH- 1. HISTOROW.HISTOHEIGHT- 1. BLACK); DrawHLinedmageDau.HISTOCOL.HISTOROW+HISTOHEIGHT-l .HISTOWIDTH-l.BLACK): DrawHLιne(ImageDaU.HISTOCOL.HISTOROW.HISTOWIDTH-l.BLACK); /* Dau base line */ DrawHLine(ImageDau.AXISCOL.AXISROW.AXISLENGTH.WHITE). DrawHLinedmageDau.AXISCOL.AXISROW + 1.AXISLENGTH.WHITE). /* Now do the actual histogram rendering into the image buffer. */ for (Index-0: Index < MAXQUANTLEVELS: Index+ + ) { LineLength = (unsιgned)(((long) Hιstogram[Index] * MAXDEFLECTION) / (long) MaxRepeat); XPos = DATACOL + lndex*2; YPos = DATAROW - LineLength; Dra w VLinedmageDau .XPos . YPos. LineLength.66) : 1 /* Display the image overlayed with the histogram •/ DispiaylmagelnBufdmageDau.NOVGAINIT.WAITFORKEY); /* After display, restore image dau under histogram */ Wri t elmageAreaFromBuftBuffer.HISTOWIDTH.HISTOHEIGHT.ImageDau. HISTOCOL.HISTOROW); farfree((BYTE far *)Buffer); } /* Various Point Transformation Functions */ void AdjImageBrightness(BYTE huge 'ImageDau. short BrighmessFactor, unsigned Col. unsigned Row. unsigned Width, unsigned Height) { register unsigned Index; register short NewUvel; BYTE LookUpTablefMAXQUANTLEVELS]; for (Index = MINSAMPLEVAL; Index < MAXQUANTLEVELS; Index+ + ) { NewUvel - Index + BrighmessFactor: NewUvel - (NewUvel < MINSAMPLEVAL) ? MINSAMPLEVAL:NewUvel; NewUvel = (NewUvel > MAXSAMPLEVAL) ? MAXSAMPLEVAL: NewUvel; LookUpTablef Index] = NewUvel; } PtTransf ormdmageDau. Col . Row , Width.Height. LookUpTable) ; } /* This function will negate an image pixel by pixel. Threshold is the value of image dau where the negaution begins. If threshold is 0. all pixel values are negated. That is, pixel value 0 becomes 63 and pixel value 63 becomes 0. If threshold is greater than 0. the pixel values in the range 0.. Threshold- 1 are left alone while pixel values between Threshold..63 are negated. » / void NegateImage(BYTE huge 'ImageDau. unsigned Threshold, unsigned Col. unsigned Row. unsigned Width, unsigned Height) { register unsigned Index: BYTE LookUpTablefMAXQUANTLEVELS]; /* Straight through mapping initially */ InitiahzeLUT(LookUpTable) ; /* from Threshold onward, negate entry in LUT */ for (Index = Threshold: Index < MAXQUANTLEVELS: Index + +) LookUpTableflndex] = MAXSAMPLEVAL - Index; PtTransform(ImageDau.Col.Row.Width.Height.LookUpTable); } /* This function converts a gray scale image to a binary image with each pixel either on (WHITE) or off (BLACK). The pixel level at which the cut off is made is controlled by Threshold. Pixels in the range 0.. Threshold- 1 become black while pixel values between Threshold..63 become white. •/ void Thresholdlmage(BYTE huge 'ImageDau, unsigned Threshold, unsigned Col. unsigned Row, unsigned Width, unsigned Height) { register unsigned Index: BYTE LookUpTable[MAXQUANTLEVELS]; for (Index = MINSAMPLEVAL; Index < Threshold; Index + +) LookUpTableflndex] = BLACK; for (Index = Threshold: Index < MAXQUANTLEVELS; Index + + ) LookUpTableflndex] = WHITE; PtTransformdmageDaU. Col .Row , Width.Height.LookUpTable) ; } void StretchlmageComrast(BYTE huge 'ImageDau. unsigned 'HistoData. unsigned Threshold, unsigned Col. unsigned Row. unsigned Width, unsigned Height) { register unsigned Index. NewMin. NewMax: double StepSiz. StepVal BYTE LookUpTablefMAXQUANTLEVELS]; /* Search from the low bin towards the high bin for the first one that exceeds the threshold */ for dndex=0: Index < MAXQUANTLEVELS: Index+ +) if (HistoDauflndex] > Threshold) break; NewMin = Index; Search from the high bin towards the low bin for the first one that exceeds the threshold */ for (Index -MAXSAMPLEVAL. Index > NewMin: Index-) if (HistoDauflndex] > Threshold) break; NewMax = Index; StepSiz = (double)MAXQUANTLEVELS/(double)(NewMax-NewMιn+ l) StepVal = 0.0; /* values below new minimum are assigned zero in the LUT */ for (Index =0; Index < NewMin: Index+ + ) LookUpTableflndex] = MINSAMPLEVAL. /* values above new maximum are assigned the max sample value */ for (Index = NewMax + 1: Index < MAXQUANTLEVELS: Index+ +) LookUpTableflndex] = MAXSAMPLEVAL; /* values between the new minimum and new maximum are stretched */ for (Index -NewMin: Index < = NewMax: Index + +) { LookUpTableflndex] - StepVal: StepVal + - StepSiz; } /• Look Up Table is now prepared to point transform the image dau. */ PtTransform(ImageDaU.Col.Row,Width,Heighι,LookUpTable); }

Claims: 76 I CLAIM : 1. A 2-dlmensional display device on which an image formed by discrete pixels is presented, the display device having means for dynamically varying across the image, pixel by pixel, the apparent visual distance from a viewer, positioned in front of the display device, at which each individual pixel appears, whereby a 3-dimenslonal image is created. 2. A display device as claimed in claim 1 in which the means for dynamically varying comprises an array of transparent optical refractory elements aligned respectively in front of the pixels and each having a focal length which varies progressively along refractory surfaces oriented generally parallel to the image, and means for displacing minutely within a pixel the location at which light is emitted according to a desired depth such that there is a corresponding displacement of an input location of the light along an input refractory surface of the optical element whereby the apparent visual distance from the viewer varies according to the displacement of the input location of light. 3. A display device as claimed in claim 2 in which the refractory surfaces are shaped to provide the varying focal length. 4. A display device as claimed in claim 2 in which the optical refractory elements are each made of gradient index optical materials in which the index of refraction varies progressively along the refractory element to produce the varying focal length. 5. A display device as claimed in claim 2 in which the relationship between the displacement and the focal length is linear. 6. A display device as claimed in claim 2 in which the relationship between the displacement and the focal length is non-linear. 7. A display device as claimed in claim 2 in which each optical refracting element has a focal length which varies radially with respect to an optical axis of the optical refractory element, and the displacing means displaces radially within a pixel the location at which light is emitted. 8. A display device as claimed in claim 2 in which each optical refractory element is elongate and has a focal length which varies along its length from one end, and the display means displaces linearly within a pixel the point at which light is emitted. 9. A display device as claimed in claim 2, 7 or 8 in which the display device Includes one of a liquid crystal display device, electroluminescence device and plasma display device as a light source. 10. A display device as claimed in claim 8 in which the display device includes a cathode ray tube having thereon a plurality of elongate phosphor pixels and including means for displacing the electron beam along each phosphor pixel whereby the point at which light is emitted and the input point of light for the respective optical element are similarly displaced. 11. A display device as claimed in claim 10 in which the electron beam is rectangular in cross-section. 12. A display device as claimed in claim 10 in which the electron beam is oval in cross section. 13. A display device as claimed in claim 10 in which the display device is a television receiver having means for extracting a depth component for each pixel from a received signal and means for adding the depth component to the conventional horizontal scan line to control the vertical level of the horizontal scan line pixel by pixel whereby a stepped raster scan line is obtained. 14. A display device as claimed in claim 2 in which a minute interstitial gap is provided between the individual optical elements. 15. A display device as claimed in claim 14 in which a black opaque material fills the interstitial gap. 16. A display device as claimed in claim 2 in which the transparent optical elements are provided as an embossed sheet of plastics material. 17. A display device as claimed in claim 2 in which the transparent optical elements are provided on a sheet of injection moulded plastics material. 18. A display device as claimed in claim 2 in which each optical element is a compound device comprising at least two individual optical components. 19. A display device as claimed in claim 18 in which the at least two individual optical components are provided as at least two embossed sheets of plastics material which are cemented together. 20. A display device as claimed In claim 18 in which the at least two individual optical components are provided as at least two embossed sheets of plastics material which are secured together at their edges. 21. A display device as claimed in claim 8 in which the display device is a viewer or projector for a photographic film transparency and the means for displacing the point at which light is emitted comprises a mask applied to each pixel of the transparency such that a preselected transparent point is provided. 22. A display device as claimed in claim 1 in which the 2-dimensional image is a printed or photographic image and the means for dynamically varying comprises an array of mlcrolenses aligned respectively with the pixels and applied to the 2-dlmensional image, each microlens having a respective focal length chosen to portray the associated pixel at a predetermined distance from the viewer. 23. A method of forming a 3-dimenslonal image from a 2-dlmensional image display comprising breaking the 2- dlmensional image into pixels and dynamically varying across the Image, pixel by pixel, the apparent visual distance from a viewer positioned in front of the display at which each individual pixel appears. 24. A method as claimed in claim 23 in which the 2- dimensional image is formed in one of a cathode ray tube, liquid crystal display device, electroluminescence device, plasma display device, photographic slide and motion picture film, comprising the steps of displacing within each pixel the location at which light is emitted from the 2-dimensional image, and passing the emitted light through optical elements aligned respectively in front of the pixels, the location at which the emitted light enters the optical elements determining the apparent depth of the pixel. 25. A method according to claim 24 in which the step of displacing the location at which light is emitted from the 2-dimenslonal image, comprises displacing the point linearly at which light is emitted from the 2-dimensional Image. 26. A method according to claim 24 in which the step of displaying the location at which light is emitted from the 2-dimenslonal image comprises displacing the location radially at which light is emitted from the 2-dlmensional image. 27. A method of encoding a television broadcast signal comprising the steps of generating a depth signal for each pixel and adding the depth signal as a component of the broadcast signal. 28. A method of decoding a television broadcast signal encoded according to claim 27 comprising the step of extracting the depth signal component. 29. A method of encoding a television broadcast signal as claimed in claim 27 in which the step of generating the depth signal comprises a triangulation technique using two spaced cameras. 30. A method of encoding a television broadcast signal as claimed in claim 27 in which the step of generating the depth signal comprises the use of non- optical depth sensors. 31. A method of retrofitting 3-D Information to conventional 2-D imaging, comprising the steps of digitizing each scene, defining individual objects in the scene, assigning a specified depth to each object in the scene, scanning each pixel in the scene and assigning respective depth components to the pixels according to the specified depth. 32. A 2-dlmensional display device comprising a cathode ray tube having thereon a plurality of rectangular phosphor pixels each having a length and a width and including means for displacing an electron beam along the length of each phosphor pixel according to a desired depth, and an array of rectangular transparent optical refractory elements aligned respectively In front of the pixels and each having a length and a width, each optical element having a focal length which varies progressively along the length of the optical element, whereby the apparent visual distance from a viewer, positioned in front of the display device, at which each individual pixel appears varies according to the desired depth thereby creating a 3- dlmensional image. 33. A display device as claimed in claim 32 in which the pixels are aligned in rows. 34. A display device as claimed in claim 33 in which the display device Is a television receiver having means for extracting a depth component for each pixel from a received signal and means for adding the depth component to the conventional horizontal scan line to control the vertical level of the horizontal scan line pixel by pixel whereby a stepped raster scan line is obtained. 35. A display device as claimed in claim 1 in which the means for dynamically varying comprises an array of transparent optical elements aligned respectively in front of the pixels and each having a focal length which varies progressively along surfaces oriented generally parallel to the image, and means for displacing minutely within a pixel the location at which light is emitted according to a desired depth such that there is a corresponding displacement of an input location of the light along an input surface of the optical element whereby the apparent visual distance from the viewer varies according to the displacement of the input location of light. 36. A display device as claimed in claim 1 in which the means for dynamically varying comprises an array of transparent optical reflecting elements aligned respectively in front of the pixels and each having a focal length which varies progressively along reflecting surfaces oriented generally parallel to the image, and means for displacing minutely within a pixel the location at which light is emitted according to a desired depth such that there is a corresponding displacement of an input location of the light along an input reflecting surface of the optical element whereby the apparent visual distance from the viewer varies according to the displacement of the input location of light. 37. A display device as claimed in claim 36 in which each optical element comprises a plane mirror and a concave mirror. 38. A display device as claimed in claim 37 in which each plane mirror is formed as one surface of a combined element another surface of which forms a concave mirror of an adjacent pixel. 39. A display device as claimed in claim 10, 32, or 33 in which the display device is a computer monitor and computer based video driver electronics having means for extracting a depth component from each pixel from data received from a computer and means for adding the depth component to the conventional horizontal scan line pixel by pixel whereby a stepped raster Is obtained.

Inventors: ZELITT SHELDON S, ZELITT, SHELDON, S.
Applicants: ZELITT SHELDON S, ZELITT, SHELDON, S.
Application year: 1995
Main classification: G02B27
IPC codes: G02B3, G02B27, G03B21, G03B35, G09F9, G09G3, H04N7, H04N13, H04N15