[go: up one dir, main page]

CA2147333A1 - Panoramic viewing system - Google Patents

Panoramic viewing system

Info

Publication number
CA2147333A1
CA2147333A1 CA002147333A CA2147333A CA2147333A1 CA 2147333 A1 CA2147333 A1 CA 2147333A1 CA 002147333 A CA002147333 A CA 002147333A CA 2147333 A CA2147333 A CA 2147333A CA 2147333 A1 CA2147333 A1 CA 2147333A1
Authority
CA
Canada
Prior art keywords
optical element
radiation
annular
view
compound lens
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Abandoned
Application number
CA002147333A
Other languages
French (fr)
Inventor
Stephen L. Bogner
Jeremy Leonard
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Individual
Original Assignee
Individual
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Individual filed Critical Individual
Priority to CA002147333A priority Critical patent/CA2147333A1/en
Publication of CA2147333A1 publication Critical patent/CA2147333A1/en
Abandoned legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • G06T3/047Fisheye or wide-angle transformations

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Studio Devices (AREA)

Abstract

An imaging system having a compound lens with a wide angle azimuthal field of view and an annular field of view surrounding the wide angle field of view, together with a camera to receive radiation corresponding to distorted images directed towards it by the compound lens, an image transformer to transform the distorted images from the compound lens and a display device to display undistorted images from the image transformer.A compound lens with overlapping fields of view such that stereoscopic images may be obtained through a camera and corresponding display system. A compound lens with an annular optical element with an annular field of view and an azimuthal optical element with a field of view covering at least acute angles to the azimuth, in which the resolution of the annular optical element is essentially constant. A compound lens having an azimuthal optical element with a field of view including acute angles to the azimuth, and plural annular optical elements, all of which direct radiation through a radiation receiving aperture towards a camera.

Description

TITLE OF THE INVENTION:
Panoramic Viewing System NAME(S) OF INVENTOR(S):
Stephen L. Bogner Jeremy Leonard FIELD OF THE INVENTION
This invention relates to an apparatus and method for acquiring and displaying wide angle images.
CLAIM TO COPYRIGHT
A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.
2 5 R~ ROUND OF THE INVENTION
Various lenses are known for receiving radiation from a panoramic field of view, as shown in United States patents nos. 4,566,763 of Greguss; 5,033,833 of Brown; and 5,308,985 of Lee. In particular, Brown describes a device that collects radiation from a virtually spherical field of view, although the primary purpose of Brown appears to be related to use as an antenna, for taking a collimated beam of light and expanding it into an omnidirectional broadcast.
At the same time, it is known from patents 5,185,667; 5,313,306 and 5,359,363 of Tele-Robotics International Inc. to view an image through a fish eye lens and electronically process the image to effect pan-tilt, 21~7333 rotation and magnification of the image without moving the fish eye lens.
On the other hand, there has as yet to the knowledge of the inventor been no system proposed for the optical processing to remove distortion of images from a compound lens having a wide angle azimuthal field of view and an annular field of view surrounding the wide angle field of view, nor has there been provided a stereographic compound lens, or a compound lens with an annular reflecting element having a constant resolution.

SU~ARY OF THE INVENTION
There is therefore proposed in accordance with one aspect of the invention, an imaging system having a compound lens with an annular field of view, and may also have a distinct wide angle field of view, with the annular field of view surrounding the wide angle field of view, together with a camera to receive radiation corresponding to distorted images directed towards it by the compound lens, an image transformer to transform the distorted images from the compound lens and a display device to display undistorted images from the image transformer.
In accordance with a further aspect of the invention there is provided a compound lens with overlapping fields of view such that stereoscopic images may be obtained through a camera and corresponding display system.
In accordance with a still further aspect of the invention, there is provided a compound lens with an annular optical element with an annular field of view and an azimuthal optical element with a field of view covering at least acute angles to the azimuth, in which the resolution of the annular optical element is essentially constant.

214~3 In accordance with a still further aspect of the invention, there is provided a compound lens having an azimuthal optical element with a field of view including acute angles to the azimuth, and plural annular optical elements, all of which direct radiation through a radiation receiving aperture towards a camera.
The annular optical elements are preferably reflecting, while the azimuthal optical element is preferably refracting. The annular optical elements have a central aperture or transparent centre to allow radiation collected by the azimuthal optical element, or other annular optical elements, to pass through the annular optical element into a camera.
In accordance with a still further aspect of the invention, there is provided a method of inspecting a pipe or other hollow object having an interior surface, using a probe with a camera and a panoramic imaging device with a lateral field of view and a forward field of view, preferably a cone, which may have a central aperture. The probe is moved through the pipe and the interior surface of the pipe is imaged.

BRIEF DESCRIPTION OF THE DRAWINGS
There will now be described preferred embodiments of the invention, with reference to the drawings, by way of illustration, in which like numerals denote like elements and in which:
Fig. lA is a section of a compound lens according to the invention;
Fig. lB is a section of a generalized conical mirror;
Fig. 2 is a section through another embodiment of a compound lens according to the invention;
Fig. 3 is a perspective of the lens of Fig. 2;

2147~33 Fig. 4 is a schematic showing a generalized surface R of an annular optical element;
Fig. 5 is a schematic showing fields of view of several optical elements;
Fig. 6 is a graph showing resolution of the optical elements of Fig. 5;
Fig. 7 is a schematic of a stereographic viewing apparatus according to one aspect of the invention;
Fig. 8 is a schematic of a first embodiment panoramic viewing system according to the invention;
Fig. 9 is a schematic of a second embodiment panoramic viewing system according to the invention;
Fig. 10 is a schematic showing details of data processing for use with the system of Fig. 8;
Fig. 11 is a schematic showing details of data processing for a remote surveillance system according to the invention;
Fig. 12 is a schematic showing details of data processing for an armoured vehicle surveillance system according to the invention.
Appendix A contains software for processing an image from a conical mirror.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS
Definitions: In this patent document, radiation means electromagnetic radiation including light in the visible and infra red ranges.
Fig. lA shows a compound lens 10 that is cylindrical, such that the section shown is representative of all sections that include the central axis Ax. In use, the compound lens 10 may be oriented in any direction as required. The compound lens 10 is formed from plural optical elements mounted in a housing. The housing includes a first mounting block 12 at one (azimuthal) end of the 21~7333 housing and a second mounting block 14 at the other end of the housing. The mounting blocks 12 and 14 are connected by a cylindrical window 16 that is transparent to the radiation of interest. The window 16 is preferably axially aligned with the axis Ax. The axis Ax defines an azimuth Az in the direction shown. At the other end of the housing, the second mounting block 14 defines a radiation collecting aperture 18 through which radiation collected by the compound lens 10 may pass.
10An azimuthal optical element 20 is attached to the first mounting block 12, having a field of view v1 that in the embodiment as shown is hemi-spherical, extending from the azimuth to 90 from the azimuth on both sides of the azimuth. The azimuthal optical element 20 is preferably 15made of refracting elements 20A, 20B, 20C and 20D or other refracting elements together forming a fish eye lens. Other lenses may be used for the azimuthal optical element 20, such as the PAL~ lens described in United States patent 4,566,763. The azimuthal optical element has a field of view Vl including viewing directions at an acute angle to the azimuth, and while it does not necessarily include the azimuth itself, the azimuth is preferably included and the field of view is preferably wide angle, greater than 45 on either side of the azimuth. The azimuthal optical element 20 is oriented to direct radiation through the radiation collecting aperture 18.
An annular optical element 22 is attached to the housing, preferably the mounting block 12, and has an annular field of view V2 including viewing directions at an obtuse angle to the azimuth (greater than 90). The annular optical element 22 has a central aperture 24 for passage of radiation from the azimuthal optical element 20 and is oriented to direct radiation through the radiation collecting aperture 18. The annular optical element 22 is 2147~3 preferably a truncated reflecting mirror with an aperture as shown. The cone axis is selected to direct radiation from the annular field of view V2 into the radiation collecting aperture 18.
A further annular optical element 26 is preferably disposed within the housing and attached to the annular optical element 22. The annular optical element 26 has an annular field of view V3 including viewing directions at an obtuse angle to the azimuth. The field of view V3 is at least partly distinct from the field of view V2. Overlap of the fields of view V2, V3 facilitates processing of the images from the optical elements 22, 26, and allows sterographic imaging. The optical element 26 has a radiation collecting surface that is preferably a portion of a spherical reflecting mirror. In the case where no overlap between adjacent fields of view is desired, the tangent of the surface of the optical element 26 at the point of contact with the optical element 22 should be parallel to the surface of the optical element 22. If the tangents are not the same at the point of contact, then there is either a gap, which is generally not desired, or overlap, which may be desirable in the case of stereographic imaging. The annular optical element 26 has a central aperture 28 for passage of radiation from the azimuthal optical element 20 and is oriented to direct radiation through the radiation collecting aperture 18.
A further embodiment of a compound lens is shown in Figs. 2 and 3. In this instance, annular optical element 30 has an exterior reflecting surface defining part of a sphere, such that the surface of the annular optical element 30 has constant radius of curvature. An aperture 31 is formed in the central part of annular optical element 30. Refracting optical element 32 is a wide angle lens of conventional design. Wide angle lens 32 and annular optical element 30 are mounted on mounting block 34 axially centered over the aperture 31. Mounting block 34 also has an aperture, or is transparent to the radiation of interest under the wide angle lens 32. At the opposed end of the compound lens is a second mounting block 36 connected to the mounting block 34 by rod supports 38. Mounting block 36 includes a central apertured adaptor 40 for fitting onto threads of a camera or other radiation sensing device.
Radiation is directed by both the annular and wide angle optical elements 30 and 32 through the adaptor 40.
The use of a spherical annular lens 30 has an important advantage in the construction of a compound lens that may be understood by reference to Fig. 4. In Fig. 4, R is a generalized surface of an annular reflecting optical element, such as annular optical element 30, points on which are defined by angle ~ and distance r from a centre S. There is also a third dimension formed by rotation of Fig. 4 about the y axis that defines the surface R, but for simplicity the two dimensional case is discussed, which applies to all sections through the annular optical element. F represents the iris of an optical sensing device such as that of camera 50 shown in Fig. 7. P is the locus of points spaced from S by the distance of F from S. Q is the contact point on R of a light ray LS from the field of view of the optical element defined by the surface R that reflects to the iris F. V is the intersection of LS with P.
~ is the angular distance of V from F. T is the extension of the radius r at Q. For a given camera receiving radiation from the light ray LS reflected from the surface R, indicated by the line LS, each pixel of the camera will receive light from a given area, measured in milliradians squared (mrad2), of the field of view of the surface R. A
spherical reflecting surface R such as optical element 30 shown in Fig. 2 has a constant resolution across its field 214~333 of view for an areal imaging device located perpendicular to the optical axis SF and located beyond the iris F. That is, for each angle ~, the resolution value in pixel/mrad2 is constant. This gives uniform texture. Thus, for any annular reflecting element having a spherical surface, for example element 26 in Fig. lA, the resolution is constant across its field of view, for example V3 in Fig. lA.
Referring to Fig. 5, a compound lens is made from a first spherical reflecting annular optical element 42 and a second spherical reflecting annular optical element 44 having a smaller radius than optical element 42. The compound lens also includes a fish eye optical element 46.
Referring to Fig. 6, a graph is shown of the resolution in pixels/mrad2 for the compound lens of Fig. 5. Lines A, B
and C are essentially flat, indicating constant resolution and correspond to the optical elements 44, 42 and 46 respectively. The smaller the radius of the sphere, the lower the resolution. Having a compound lens with distinct optical elements with distinct but constant resolution over their fields of view permits the compound lens to provide better quality images in defined regions, as for example the horizon (90 azimuth).
Referring still to Fig. 5, the azimuthal optical element 46 has a field of view including the line LS1, and the first annular optical element 42 has a field of view including the line LS2. In this instance, LS2 is the limit of the field of view of optical element 42. However, the fields of view of optical elements 42 and 46 overlap in the area defined by OV1. Thus, radiation from OV1 may be imaged on separate pixels of a radiation sensing device, thus providing spatially separate views of images in the overlapping field of view. These images may be processed separately and provided separately to the eye6 of a viewer to present a stereoscopic view as shown in Fig. 7. In Fig.

2147~33 7, radiation collected by optical element 42 and optical element 46 from overlapping field of view OV1 is provided to camera 50 and thence to image transformation device 52, which corrects for distortion of the images, and provides signals to stereoscopic display devices 54 and 56, which in turn provides stereoscopic images to eyes 58 and 59 of a viewer .
Referring again to Fig. 5, optical element 44 includes line of sight LS4 and optical element 42 includes line of sight LS3. The fields of view of the optical elements 42 and 44 thus overlap in the area defined by OV2.
Radiation from area Ov2 may also be processed separately by camera 50, image transformation device 52 and display devices 54 and 56 to present a stereoscopic image.
Referring again to Figs. 1, the annular optical elements 22 and 26 receive radiation through the window 16 and reflect it through the aperture 18 and in Fig. 2, the optical elements 30 and 32 direct radiation through the adaptor 40. The mounting block 14 and adaptor 40 preferably include a conventional threaded connection for threading onto the filter adaptor 62 of a conventional camera 50 shown in Fig. 8. Camera 50 may be for example a large CCD
high resolution camera with 2048 x 2048 pixels at 30 fps.
However, the higher the resolution the better. For example, a 20k x 20k CCD camera made by Carl Zeiss could be used. In Fig. 8, there is also shown a panoramic viewing system comprising the compound lens 10, camera 50, image transformation device 52, computer 55 and display device 60. In some cases, such as with pipeline inspection tools, images from the compound lens 10 may be recorded on video tape at the camera 50 and the video tape later played back for viewing, or the images transferred from the video tape to the image transformation device 52 for processing.

The camera 50 is oriented to receive radiation passing through the radiation collecting aperture 18 and converts the radiation into electrical signals corresponding to transformations of images viewed by the compound lens 10. The transformations referred to here are the transformations effected by the compound lens 10. The images seen through the aperture 18, without remapping, are distorted and correspond to an uncorrected panoramic view and fish eye view. The image transformer 52 is connected to receive the electrical signals from the camera 50 and has output comprising processed electrical signals corresponding to the images viewed by the compound lens 10.
The electrical signals output by the image transformer 52 could be provided directly to a display 60, but it is preferable that some kind of digital processor 55 or the like be used to manipulate the electrical signals. Both image transformer 52 and computer 55 could be implemented in the same device as shown in Fig. 7. The display device 60 has as input the processed electrical signals and as output radiation patterns corresponding to the images viewed by the compound lens 10.
The image transformer 52 itself is known in the art, apart from the precise algorithms required to undistort the viewed image of the annular lens. Software that includes the algorithms to undistort the image of a conical mirror is attached as appendix A. Such an image transformer 52 is disclosed in United States patent no.
5,185,667 of Zimmerman, which includes an algorithm for undoing distortion caused by a fish eye lens. Another image transformer that could be used is disclosed in United States patent no. 5,067,019 of Juday et al. The algorithms required to undo distortion for a given mirror may be readily calculated from the particular optic~ used. The location of the annular optical element 22 from the optics 21~7~33 of the camera 50 is determined by the desired field of view, and may be calculated from the geometry of the lens given a desired field of view. The conical surface of the annular optical element 22 need not be flat, but may be curved. As for example, for a generalized cone 22A shown in Fig. lB, where P is the distance from the tip of the cone to the lens of a camera, Q is the height of the cone and R
is the maximum radius of the cone (at its base), then the field of view defined by a, the angle above the horizon, and ~, the angle below the horizon, is given by a =
2arctan(Q/R)-arctan((P+Q)/R) and ~ = 2arctan(R/Q) - 90.
The display devices 54, 56 or 60 may be a conventional computer monitor on which is displayed slices or parts of the image, or some portion of the image, or the entire image in strip form. Alternatively, the display devices 54, 56 or 60 may be a helmet or other virtual reality display device that mimics three dimensional viewing. As the helmet is turned by the wearer, the image on the display devices 54, 56 or 60 may be changed in accordance with the direction of view of the wearer of the helmet. A wide view within the helmet of 120 x 90 degrees is desirable.
The display device 60 may be mounted within a vehicle having an operator's compartment with an inner periphery and the display device 60 may be mounted around the inner periphery of the vehicle.
Plural compound lens systems may direct radiation to one camera, or one compound lens could direct radiation to more than one camera. As shown in Fig. 9, a reflecting element 70 or elements may be mounted to direct radiation from the compound lens 10 into one or more cameras 50. The reflecting element 70 may be rotatably mounted to direct radiation into the cameras 50. One of the camera~ 50 8hown in Fig. 9 may be a zoom camera which can be positioned in 21~73~3 the imaging plane so as to image a specific region of the compound lens at various levels of magnification.
The compound lens 10 may thus be used to image a scene by (a) collecting radiation from the scene with the annular optical element 20 to form a first radiation beam and directing the first radiation beam into a radiation collecting device such as the camera 50 and (b) collecting radiation from the scene with the azimuthal optical element to form a second radiation beam and directing the second radiation beam within the first radiation beam into the radiation collecting device. In the case of using a conical reflecting mirror for the annular optical element, the radiation is reflected towards the radiation collecting device, and in the case of the fish eye lens, the radiation is refracted towards the radiation collecting device.
The method of operation may also include collecting radiation from the scene with a partly spherical annular optical element 26 to form a third radiation beam and directing the third radiation beam within the first annular radiation beam into the radiation collecting device. The first, second and third radiation beams are converted into electrical signals by the camera and the signals processed to remove image distortion created by collecting the radiation from the scene.
Instead of a camera, an optical system may be used to optically transform radiation collected from the scene to remove image distortion created by collecting the radiation from the scene. This may be accomplished by directing the collected radiation beams through a system of lens to an inverted compound lens.
Referring to Fig. 10, sensor 64 includes compound lens 10 and camera 50. Image transformer or remapper 72 corresponds to the image transformation device 52. Data compression of the transformed image using compressor 74, encryption using encryptor 76 are all optional, using conventional techniques. The transformed, and perhaps compressed and encrypted, data stream is transmitted by conventional transmitter 78 over cable, fibre optic or wireless according to international standards for broadcast data to conventional receiver 80. The signal received by conventional receiver 80 is decoded in conventional decoder 82 if necessary, decompressed in decompressor 84, if necessary, and send to clipper 86, under control of PTR
(pan, tilt, rotate) controller 88. Together, clipper 86 and controller 88 may be embodied in a conventional computer equipped with a joystick. The controlled image may be displayed on display 60. Clipper 86 holds the entire incoming image in a buffer, and uses positioning input from PTR controller 88 to determine the appropriate portion of the image to send on to the display. The PTR controller 88, such as a commercially available joystick with control software, allows control of the image on the display. The PTR controller 88 may also be a conventional head orientation controller that accepts inputs from a helmet worn by a person and controls the image displayed in a helmet according to the orientation of the person's head.
A configuration of a remote surveillance system is shown in Fig. 11 in which plural sensors 64 located at different locations, and which may be mounted on separate vehicles, provide data directly to transmitters 90 located with the sensors 64, and thence to receiver 92. The receiver 92 provides uncorrected image signals to remapper 94, which in turn provides transformed image signals to clipper 86 controlled by PTR controller 88. The image data is then provided to display 60.
In an armoured vehicle viewing system configuration shown in Fig. 6, a 8ingle sensor 64, remapper 72, and transmitter 90 sends plural data streams to plural - 21~7333 sites 100, for example for a commander, gunner and driver within an armoured vehicle. The sites 100 each include a receiver 92, clipper 86 and PTR controller 88 with display 60. The system may be used in other vehicles such as an armoured vehicle, helicopter, fixed-wing aircraft, ship, or large ground vehicle, or a submarine, in which the compound lens is incorporated into the periscope system, the display being provided by any of the standard display devices. The system may also be used in a teleoperated, telemanaged, or robotic vehicle.
The imaging device thus consists of a panoramic lens that directs light from a substantially spherical field of view into the optics of a camera, where the image is captured. The image thus produced has a characteristic format of concentric circular regions, each region exhibiting a particular type of optical distortion. This formatted image may be projected through inverse optics onto an effectively spherical screen to create an undistorted panomersive display, or may be undistorted algorithmically using high speed digital processors with the corrected image being output in digital format for recording, display, or analysis.
The compound lens may also be used as the focusing element of an illumination system so as to achieve panospheric illumination. The image transformers may also include a pixel based motion detector or pixel based orientation calculator. The stereographic system of Fig. 7 or several such systems as shown in Fig. 8, or several vertically separated compound lenses, may be coupled into an analysis device to determine bearing and range through triangulation of objects in their common field of view.
The captured imagery may be recorded to a digital media with simultaneous recording of the camera location and orientation. The location data may be used as an index to retrieve the image and the orientation data may be used to align the image so as to be consistent with previous imagery. The location and orientation data may be provided by GPS. The imaging system may also be used in or as part of a reconnaissance, surveillance, target acquisition, or fire control system, or as a pipeline inspection system.
The high resolution camera of Carl zeiss may very advantageously be used together with the uniform resolution compound lens together with selective sampling of the pixels in the camera as a function of the angle ~ (Fig. 4) to selectively vary the resolution. By selectively sampling the pixels, efficient use of the transmission bandwidth may be made, while retaining constant resolution.
In an embodiment of the invention for use with a pipeline imaging system shown in Fig. 13, a probe 101 is used to inspect the interior surface 102 of a pipe 104. A
probe 101 is used that has a camera such as camera 50 and a panoramic imaging device 106 with at least a lateral field of view. Camera 50 is preferably equipped with a video tape for direct recording of images. The panoramic imaging device may also have a forward field of view. The panoramic imaging device is preferably a cone 108, which may have a central aperture 110 for viewing a forward image. The probe 101 is moved through the pipe 104 with a tether 112 in a conventional manner and the interior surface 102 of the pipe 104 is imaged. The image is captured on video tape as the probe is pulled through at low speed. Once the probe reaches the end of a section to be imaged, the probe is removed from the pipe and the video tape may be removed and processed. The video tape processing transforms the warped images from the camera into a three dimensional texture map which can be applied to the inner surface of the cylinder. The software attached as appendix A may be used. An operator may then inspect the representation of the pipe as rendered on a computer graphics screen or other imaging device. If defects in the pipe are found, the system may be used to provide the distance from the end of the imaged section of pipe by using frame index information. Alternatively, the pipe may be imaged in real time with signals sent along a cable to an image processor.
Light for the imaging is provided by a lighting system 114 carried by the probe. Image quality may be improved by closing the aperture of the lens system of the camera 50 until there is effectively pin-hole optics. For imaging with a conical reflecting mirror as an annular optical element, the mirror should have a surface that is as smooth as possible, for example as made using a diamond tipped laser guided micro-surface lathe, with cutting accuracy within 1 micron. Larger diameter mirrors, such as in the order of 10 cm provide better results than smaller mirrors. The imaging system with the conical mirror alone may also be used to view any scene and the images from the camera processed to transform the image into an undistorted image.
A person skilled in the art could make immaterial modifications to the invention described and claimed in this patent without departing from the essence of the invention.

21~7333 Appendix A 17 e:~pv~ of~ware~conic~no~xil~dxe6~0urce.txt . eag~ 1 Printed 11:08 10 Apr g5 ~t $1d. defs.h,~r 1.1 199!~/02~2~ 21:25-07 kQvit23 Exp kaYita ~ *~
~*****~***~t*~****t**~*X******~*~*~W~***~*~***~*********~**~
~r File . : def~h *
* *
D~scrip~ion ~ file e:on~ains 'che d~fine~ T~hich ar_ *
ca~wn to the other file~.
Author : Kavita Ravi * Da~e : ~ranuary 11, 13g5 *
* Modifications Hi~tory -* Copyright: Panor~ic viewin~ Sy~tem~ Inc. *
***~**~*~ t***t*~*~*~**************~*~*~*~X**Y~ ***~**~
#i~c~ude c~t~i~.h~
$in~1ude cmath.h~
#de~ine PI 3.l~159~b5~5~g7 ~efine BYTESIY.E ~x~ 00 #define rL~cor~oR~ 25~ t* ~ ~i nun~er o~ cc>lors *~
#aefine NCOLORS 220 ~* ~uniber c)~ colors to be used *~
#define BI.AC~
~define WHIT~ ~55 t~ef ~struct p~int{ /* ~tæ ~ructure for a 2D point int x j int y;
} pixel 7 ~*~tt~t**~%***~*~*t~tt~ %%*%****~**~**~*******~A~**A***AA~*****~

3ta~ic chlr rc~id~ $Id: inte~faoe.~,v 1.1 lgs5t02~28 21:31:51 ka~iea 3xp ka~ita $
t A ~1 * ~ ~ ~1t * ~ * 1~ ~ lt * ~ ~t tr '11 * ~t * 1~ * *
* Pil~ : interfac~e c *
* *
* ~escriptiOn: q~is file cnn~;nC: the f~n~tions for ~ildin * the ~4ti~ user i~terface 4nd the nece~sary c:~llba~k r~e~ne~.
E`unctionE : void init_ motif~ terf~e ~ ) r * Boolea~ procl~ *
Eoolean proc * void xt_loop ~ ) voi~ quit ~ ) * vald start ~ ~ *
* vo~d st~p(l vo~ d re~i~e ~ I *
* void red~w ( ) *
void po~ition ~ ~ *
~roid get_d~tA ( 1 *
void ye~roc ~ ) -~:~pvs~30ftware~coni~no~xil~dres~0u~ce.t~ Page 2 PrLnte~ 08 io Ap~ ~5 * void ~o_~roc~) t void load_private_cmap~ *
* in~ load_defaul~_cmapl~
* void load_col~
i~ v~id setYiewport~olormapt) * A~thor : Kaivita Ravi *
t D~t~ : Januar~ 11, lg9$
t Modifications ~i~tory : *
* ~opyri~ht: P~no~a~i~ Viewing System~ In~.
~r~ltt1 ~i*****~**1~**~rtt~ tt~****t*:1 **1t***1~****~ ~*****~*~t****~r**~
~* Include file~ t~
#Lnclude ~Xm~Xm.h~
#include CX~fRpwColumn.h~
$i~clude cXm~pu~.h~
#Lnclude cXm~n~A~;~.h~
~include ~X~fFrame.h~
Yinclud4 cXm~MQs~ageB.h~
Yin~l~de "de~.h' ~*~lr~r~t~r~lt~t~tt~*t~*********
* External ~ari~bles *
~ ~declarediL~ ~in.c) *
~*~*t~**** I.~ b~*~fr**~r*~ ~*~itlt~*
exter~ int display_wid~h, di~pl~y hei~ht ; ~t Size of diBplay ~; t windo~S * ~
~ ~It*****~*~*~**~l~l*i * Global va~iable~
*~*~***~t**~l *,*~**~**~

XtAppConte~t app : ti ~oti~ applic~ion ~ context *J
X~orkProcI~ ~ork_idl i J* Work pro~ed~re id ~J
XtWorkProcId work_~d ; f* Work procedure id iJ

Color~ap c~rre~t cmap , t~ Current colormap ~eing u~ed *f int ~re_depth : I* Depth of di~pl~y ~
int cmap:; J~ Flag to det~nmin~ which * colo~map is used, 0 - de~ul~
* 1 - private ~` /
Dis~lay ~firc - dl~play, ~de~t~di~play : J~ Pointer~ to inp~t ~nd * ~ layc */
Window src_win, dest_win i f* Window Id~ ~l Wi~w ~r_xid ; t~ ShellWindou Id ~J

21~7333 -e~\pvs~software~conic~nonxil~dre~ou~ce txt Page 3 Prin~ed 11 ~ lD Apr g~

~**~******~ t~***********~**~**~*~t*~*~**~*~*~*i~t~*~*~
Func~io~ : init_m~ti~i ~terface~ *
t ~ ~cription : Initialize~ ~e Xt toolkit a~d ~ ild~ the *
* user interface. Ie adds the neces~ary callback routines for the widget~. *
Parame~er~ . int alg~ *
chor ~ar~Y[] *
F~nctions Called : po~iti~n~, re~lze~), redrawt), get_data~, *
g~it~ taret), stoD~), *
ye~ ?rw ~ ), no~roc ~ ~ ~
load_colorm~ *
Returned ~alue None.
~xtern ~aria~les : di~play_hei~ht, di~pla~_width *
Olobal Y~ ble~ : app, sr~_depth, #
src_di~play, de~t_dis~la~
~rC_win, ~St_WlA, *
fr_xid, ~uxrent_~lap *
~ M~dified Variables: app, sr~_de~hr * src di~play, de6t_di6~1~y, *
* S~C_Win, dest_w~n, * fr_xid, c~rent_cm~
~ *
* A~th~r Kavita Ravi *
* ~ate : January 11, 1995 Modiii~tion~ ~i8tory :
CopyIi~ht: P~n~r C Vie~i~g Sy~tems Inc.
*
*t**~*~***~*~*~*~*~***~*~ ******~t~**~**~*~-~****~*~
~oid i~it_~ci~_interface~rgc, ~rgv) int argc ;
c~r *~Lrgvtl i I

Widget app~hell /~ Application ~hell ~id~e~ *~
Widget topl_ ~hell, to~2-~he~ Top level ~hell wndget~ ~/
Wid~et *~/bog, q~e~tion_di~bog ; ~ ~ialo~ ~idge~ ~J
W~dget dra~_areal, dr~w_area2 , l~ Dra~ area widget~ for di3pl~ying im~e~ ~/
Wid~et row~l, f~me ; ~' Mana~er w~dget for pu~h bu~t~n~ *~
Widget c ~ 1, comr2, ~om~ ; ~* PUS~ hutton widget~ for r- a~ ~J
Ar~ warg~llO] ; J~ A~ t i~t n, i ;
Di~play ~di~pla~ Pointer to disp~ay of top sh~ll t Xmgtring x~_~tringl, xm_ A~ring ; t * ~ trin~s * t XmString yes, no ;
~iLU~l *s~_vi~ , *~ _vi~u~ Vi~ual~ *~

. 20 e:~p~softw~re~conio~Jnxi~r--s~ource.txt . Page Pri~ted lt:08 10 Apr 95 int ~rc_~creen, de~t_~creen ; i~ &crYen~ 1f Colorm~ ~r~_d~f_cmap, src ~riY_cmap ; ~* X ~olor~ap~ ~J
ar g~3~a~[Y~'YCO~O~
~ eunetio~ called ~y thi~ rout~ne *J
void cIlLit ( ~, po~ition ~ ), resize ~ ), redraw{ ~ ;
v~.id ~tart ~ ), StO~ , ye~r~c ~ ~, no_proc ,' ~, ~e~ ta 1 ) void l~ad_~olo~map ~ ~;
~7t Initialize the tDolk;t *~
app_shell -- XtAppInitiali~e~app,"In~e~f~e",NU~,O,-~argc,argv,(Strin~
~)~uLL~Nn~o) ;
~* Set the title a~d location of the ~ppli~ ion 3hell ~/
n - O;
XtSet~rg~w~rg-~ln~,XmNx,20~ ; nt+ ;
XtSetArg~w~rss[n~,X~Ny,150) , ~f~ ~
Xt~etAr~ar~Js[n],~N~idth,150~ ; n** :
XtSetArg(warg~ln],XINtitle, nu~er Ineer~ace~ J n~+;
XtSetVa7ueslapp_~hell,w~gs,n~ , ~ CreAt~ et the pa~amete~/i of ~he framq! widget n = o;
~!;tSetl~g {wargls ln] ~ f~C'il;F ~ 2 ) ; nf ~ ~ ' Xt & tAr0~warg-~ ~n], r '''~r 4~Qd, ~HIT~) ; n I t ;
Xt5et~rg~wargs~n]~r ~ r ~la~ 3LAC~) ; n~+ ;
~rame ~
~tCr~at~M~n~ y ~ get ~ 7 frame'~ et~lass,app_shell,warg~,n) ;

J~ Create a row-col-l~n widget rowcol as chlld of frame.
* Thi~ acts a~ a ~~.~ -- wid~et for the c - ' widget~.

n = O ;
XtSetArg(~rg~[n],X~No~ientation,. ''~RT~ON~AL~ ; n+ I ;
XtSetArg~wargs~n~,~mNforegrou~d,WHI~) ; n~t ;
XtsetArg~w~rg~[n]~xmNbackyL~ BLaC~) ; n~ ;
rowcol = Xt~rea~ eaw;dget(nInterface~ ACollnnnWidget~lass,fram~, warg~,n~
J* Create tw~ top_level shell~ to ~erve a~ ~arents for * the di~play widyets.

display - XtDisplay{app_shell~ ;
n = O j XtSetA~warg~ln],XmNscreen, ~reenO~ pla~tdiapl~y.O)~ ; n~ , XtSetArg(waIgetn],Xm~x,20~ ; n~
XtSetArg~war~s[~l,X~Ny,220~ : n++ ;
t4~ hell =
Xt~reatePopupShell~-Camer~ Input ~topLevrl~hDl lwidgetclass~app-~hell~warg~n) n = O ;
XtSetArg~w~rgs[n],~mNs~reen, ScreenO~Di~P~ay~di~play,O)~ , n++ ;
X~SetAr~twarge[n],Xmnx,40~display_~idth~ ; n~ ;
xtsetArg~warg3ln~xmNy~2~) ; n++ ;
top~_shell =

2147~33 -e:~pvs~oftware~coni~nonxil~f~re~f~urc~ txt P~ge 5 Printed 11:08 10 Apr g5 XtCre~ePopupShel}~wa~ped Im~ge~,topLe~elShellWidgetCl~g~,app_shell, w~rg~, n~
r /~ Initlali~e ~h~ itring to be diA~playf~d in the ~stlog widget ~/
xm_string _ X~stri~gcreateLocallzed(hsele~t ce~t~ ~f cone by clicki~g mou~e bUt~
f~ Tilte ~or dialog wid~et *~
x~_s~rin~1 ~ X~String~reateLocalize~ e~age~ ;
J~ Creaee ~ ~flog widge~ fo~ di~playing ~e~a~ge~, pr~,.yting ~ the use~ for input *ata n = O ;
xtset~xg~warg~ln]~ s~y~String,xm~tringl ; n~ ;
XtsetArglwarg~ln~mNforeground~wHITE~ ; nt+;
XtsetArf~w~rg6En~ kg~o~d~B~AcK~ i ntt ;
X~SetArg~w~rg~[n~,~m~heightf20) ; n~+;
XtSet~rg~W~rg6[n] ,~m~*~lo~Titlerxm_~tringl) ; n~l ;
~tSetArg(w~rg~tn~r '~'Af~llltPo~ition~arg~nFal~e~ ; nt~ ;
*s~lo~ =
XmCreat~.~ te~ifbf~g~app-~h~ rMe~ger~w~rg6~n~ ;
~mS~rin~Pree~xmLstring~ ;
~ Call~ck routine to define lo~io~ ~ wid~et on ~reen *~
Yt~C~llh~ difbog,~ C~llback,~ositio~wO) i f~ C~eate a draw area wiaget for displaying the input ima~e * with size ~f di~ y wid~h x di~play_height.
/

draw_area~ -Xt~re~ g~d~id~et(~real",x~DrawingAreaWid~e~ ,topls hell,N~LL,O~ ;
n = O ;
XtSetArg~wargs~n1,XmNwidth,~i~pla~_width) ; n~+ ;
~t~cet~rg(war~6 rn] .XmNhe~ght,display_hei~ht) ; ~+~ ;
~SetArg(wargs[~],xmNf~ e~o~d,W~ITE~ ; n}l ;
XtSetArg~arg~[~],XxNba~h~lo~,~,BLACg) , ntt;
XtSet~lue~(draw_areal, warg~, n) :
~* ~all~ack routin~ fo~ pro~essing butto~ ~re~ e~en~ in the ~ dr~w_ areal widget.

XtAdd~llbac~raw_ar~ mNinputCall~ck,get_d~ta,di~log) :
~* Callka~k routines for expose an~ re~i~e eYen~ for dLaw_areal *J
Xt~dc~ (draw-areal~ XmNex~oseCallback,redraw,O~ ;
Xt~ A~ rk~draw-areal~ Xm~rei~ecallbackrre~i~e~o) ;
~* Craet~ a dr~w-area widget for di~p~aYing the out~ut ~age with ~i2e display_width X di~play_height.
~t draw_are~2 =
XtCreateManage~Widget~"areh2n,x~n~ir~wi~gP,re~Widg~tClass,e:o~2~ihell,NULL,O) 21~73~3 -e:~p~softwaL~conic~n~lxil~dres~urce.txt Pa~e Printed 11 08 10 Apr 35 n - ~ ;
XtSe~Arg~w~rg~tnl,x~idth,di3play_width~ ; nt +;
XtSetRrg~wdr~xrn~ ~ht~di~la~-hei~ht) ; n~
XtSetArg(w~r~s[n'~ ,XW~OLe~1OUL1d~HIT~ nll :
~t5etAr~ ~wa.rs~f Lnl ,X~ ,'~ L~ul.d,J3LACK1 ; ntt;
XtSetValue3~ar2w_area~ , ~arg~, ~) ;
J~ ~llhac~ Rout~nes for e~o~e a.~d re~ize e~en~ f~r draw_area2 XtAdd~allback~draw_area2, ~ F.cCallback,redraw,1) , XtAddCA~lb~ck ~draw_area2, XmNresize~allh~k,r~ize,~) ;

1~ Create a ~u&stion *s~lQg to A~ it t~e user w~nt~ to reselect pard~ters, with a ye8~ and ~no~ option~.
*~
~n_string = ~nStrin~CreateLoc:~li2;ed ( 'Do you want to reselect cone par~neter~? ~ ) ;
yes - ~nStringC~e~teLocal~zed~'Ye~
no = XmStr~ngCreateT-oc~ edlrNo~) ;
= O;
XtSetArg~war~stn~,' '~ ~sa~String.xm_ string) ; n+t;
~Ser~rg~r~[n],X~Nfos~ o~Ad,WHITE) ; n~ .
XtS~tArg~war~s[n~,~nNbac~ground,BLA~) ; n~+ ;
XtSetArg~w~r~[n} , XmN~YJ logTitle ~ xm _~tring1) ; n~ :
XtSetArg~wargs~n~,r ~d?f~ tPo~i~ionwarg~,nFalse) ; n*~ ;
XtSetArg(w~xg~aLrl],1~ T.~I~l string~yes~; ntt;
XtsetArg(~rgsrn]~r ~- ~1 r.Obe~ Strin~, no~ ; n I + ;
question_di~lO~ =
XICrea~eQ~e~ion~i~log~app_shell,~N~w_Mes~a~e~,w~rgs,n~ ;
~tun~nAge~hiLd(xm~e~ ~Get~hild~question~ og~xm~ALo~-~ELp-BulT~
XmStrin~ree(xm_string1) , X~StringP~eerxm_s~rin~) ;
~mS~ringPree (ye~
xmst~lngFr~e~no) ;
~ llh~ rou~ine fox 1OeatLn~ the *ialog widget on Ycreen */
X~ l1b~ck~gue~tion_dil1Og~y~mapc~llback~position~
/~ C~11back loutine~ for ~ye~ and no" button~
X~Z~ k(~uestion_~s~ g~xn~ok(~al~b~k~ye~ oc~di~b~g) i xt~dd~ back~quçstion-di/log~gmNcAn~elc~llbach~no-~roc~NuLL) ;

n - 0 ~
gtSetArg(w~r~s~n],Xm~foye~ d,WHI~E) ; nl~ ;
XtSetArg(w~rg~f~], `~ ~L~J.~ d,BLACK) ; ntt , /~ T~ree ~- ~ wi~get~ are ~ormRd a~ children o~ row~ol ~ co~ to ~uit ~he progr~m.
* comm2 -,to ~rt the w~rpin~.
~ comm3 : ~top the w.r~ proce~ure, ~,~

2147~33 e:~pv~oftware~onic~nonxil~dre~ou~ce.txt Page 7 Printed 11-08 L0 Ap~ ~5 C!O}ranl --XtCrea~ edNid~et~Quit~,xmPush~uttonwldgetcl~Ys.rowcol,warg~.nl ;

c4~m2 =
Xt~rea~ e~ flget(~Start~l,xmPu~hButton~idgetClas~,ro~col,~args,n~

co~m3 =
Xt~rea~ edWidget~Stop~,x~PushButtonwidget~las~,rowcol,~args,n) ~* Callback routLne~ ~or the c,~- -nA wid~et~ *~
XtA~ llb~ck(~omml,XmN~ctivate~lh3ck,qult,app_shell} ;
XtAr~ArAl~h~ck~comm2~x~Nactivater~llh~ tart~di/lo~ ;
xt~ h~k~comm3~Nactivatec~llh~ck~top,question-di~log~ ;
l* M~0e the child widgets 1/

Xt~opupttopL_~hell, Xt~ Nonel ;
XtPo~u~ltop~_~hell, ~t~rabNone~ ;
~tM~nArJechild(dillos~
f~ Map the wid~etc ~aXing wino~8 vi3ible *~
~t~ iz~idgettapp_shell~ ;
/~ Id o f r~ot windo~ *~
fr_xid = ~t~in~w~topl ~hell~ ;
/* ~e~ ~ome X ~v~e~ies from ~he *raw_areal ~id~et *l 8r~_displa~ ~ xtn; ~ y~d~w_~re~
sr~_wi~ Windo~draw_areal~ , ~rc_~creen:- Defaul~S~xeen~r~_display) ;
~r~_viFu~l; = De~ultVi~ual~sr~ play, ~rc_~reen);
~rc_dqpth . = Default~epth~src_di~play, src_~cre~nl;
Jlr aet ~he: de~a~21t colonnap ~

~rc_def_cmap = DefRultColor~p~src_d~splay, ~ creen);

~t Set the~c~rren~ colormap t~ def~ult 1/

~* Get ~o~e X prop~tie~ from the draw_~rea~ wid~et de~t_di~play = ~tDi~ draw_area~
dest_win = ~tWindow(dkaw area~) ;
~ C~eate a priv.~e colonmap ~J

sr~ pri~_c~ap -X~reat~Color~ap~rc_display,~c_ win. ~rc_visual,~lloc~one) , ~ di~p}a~ depth is ~, get the curren~ color~ap * to appra~riate colormap *~

curren~_c~ap ~ src_def_cmap;

21~7~33 -e:~yvs~software~onla~no~xil~dre6\60urce.~xt ~age a Printed 11:0~ 1~ Apr 95 if ~src_depth == ~ -~or ~i = O;i ~ M~XC4LOR,~
g~ p[il - i:
o~d_color~pig~_ramp,gR_~a~p,0s r~mp,~rc_def_c~ap, src DriY_cma~t;

f* Set tke colon~p for the wid~ets ~t n = 0 ;
XtSetArg~w~r~tn; ,e ~T"~l _ ar.cUrrent_c~aP) ; nl~ ;
X~Set~a~eY~dr~w_areal, wargs, nj , X~SetValue~dr~w_~re~2, warg~, n) ;
}
~*~*** ~. L ~r**l~**~ r*****~ *~1~*11**~1t-~le~*~*~lrb~ ttt*il~*~i~**ilr~**~***~**~
* FhnCtion ~r~
Descript~n : Work proceduIe which obtain~ in~ut im~ge6. *
Para~eteræ : EtPointer clien'c_data J
~nc~ion~ Called : get i~ s~ *
*
* Returned ~alue : Boolean. *
~uthor : Kavit~ Ravi Date . : January 11, lg~5 Modificat_ons History : *
~opyri~ht; P~or~ic ~iewlng Sys~en~ 1~
*t***~*~ S***~***~**I~*~***~ *~*~***~**~*~***~***~ *~
Boolean procl(~lie~t_datal XtPo~nter clie~_data ;
j~ ~rab ~na display in~u~ im~e */
ç~et_31nages ~1 ;

~ *****~***I*~*******~*~*~****~*********~*b~**~*****~
F~nction : proc~
De~c~iption : Work ~rec~d~ ~ whi~h ~er~o~ms the w~rpin~
by ~alling the Warp ro~tine *

* Paramete~ : XtPointer client_dat~ ~

Functions ~alled : warp_im~ge~ *

21~73~3 e ~c~software~conic~onxil~dres~ource.~xt Pa~e 9 Printed 11-0~ 10 Apr 95 * ~e~urned value : Boolean. t * A~thor : Kavlta Rdvi *
* Date ~ JAnuar~ S
* ~odification~ Hi~tory ~ *
* Copyright: P~nora~ic Viewing SystQm~ In~.
**t**~**~***~*~*t*~t*~****~***~***~i****t**t*t~t*~**~
le~n proc ~li~nt_datal ~tPointer ~lie~t_ddta;
~*` lni~iat~ the war~ing to ob~ain output i~age ~f warp_im~e / ~ ;

/~*~*****t*~*~*~*t*~t~****~*~*****~*~*******~*~*~ ******
* Function . : Xt_looP(~ *
~escripti~ : Pa~e~ co~trol over to ~otif window in~erf~ce.
Parameters : ~one.
Function~.~a~le~ : proc~t~ *
* Returned Yalue : None.
* ~loba~ Va~iables ~ , work_idl *
* ~odified Yariablc~ wo~idl *
t A~th~r . Ravita Ra~i * Date : January 11, lgg5 * ~olificat~on~ tory : t * Copyri~ht:, Pan~r~mi~ Viewin~ Systems In~
**~**~****~*****~***~tJI******X*~*****~*~*~t~*~*~**********t*~ tt~
void xt_ loop J~ Add wvr~ proc~ure which get~ imag~
uork_idl =',XtAppAddWorkP~o~app, procl, ~UL~) :
J* Main lo ~ of events under mo~i~ window interfa~e */
Xt~M~ oop~app) ;

J*****t.t~*~ t )r-tt~**~ ~* ** ~*~ ;*b* ~*~*tt*t*~ll JrJr~r***~*X *** **t***t~ ~**

e:~p~o~twax~o~i~nonxil~res~ource.txt Page l~
~rintOEd ll:08 lO Ap~ 95 Function : ~uit~1 *
~ Descripti~.n : ~all bach routin~ ~or the ~Ult b~tton *
* ' in ~he user inte~f~ce ~its from the progra~, cl~se3 the libra~ie~, unin#talls *
private ~olo .~_~ if in$t~ d and de~troy~
~ the widget~. ~
* P~ameter~ get ~ t ~ Widget client_da~a *
* X~Pointer ~ data *
Pun~tion~lcaIled : cIose_lib(~ ~
~ Returned value : N~ne. *
* Gl~al Variables : cDrrent_~nap, cm~p, ~rc_di~pl~y, deæt_di~pl~y *
* Au~hox ` K~Lvi~ vi *
* Date : January ll, l995 * Modification~ H~tory .
Cop~ h~ P~nor~mic~ Viewins3 Syste~ns Inc:, ***~r*~*~tle~r*~t*J~ *~llr~*lt****~**~r**~t~*lt~ll~lr~1~11~1~1~**~1-*~tt****~*~
void quit~w, ~iient_data, call_data~
Widget w;
~idget clieht_dat~;
XtPointer call~data ;
t* ~lo~e t~e xil libr~ry ~J
clo~e~
J~ Chec~ i~ pri~ate color~ap i8 in~t~lLe~, if ~o de~troy it */
lf (cmap '= 1) ', .
X~ln~tall~olo~p~orc_display~ current_cmap);
X~in~tallCol~rmap~dest_display, c~re~t c~ap~
~Unlnstall~olormap~X~Di~ y~lien~_d~t~), current_cx~p~;

1* ~e~tr~y;the shell widgets ~/
XtDe~troyWidget (C7 ient_data) ;
exit~O~ ;

/ *~*~*~*~***+~ ~*~*~ *~*r****~*~*~*~ t~*~ *~***A~***i~***
* Fun~tion , ; Ftar~
* Pe~ripti~n : ~all back routine ~or the start hutton * in the ~6er inteLface. Stalt~ the *
* ~arping pro~ed~re, di~playing input *
an~ corres~n~in.~ w~rped outpue ~mage 21~73~3 e:~pv~oftwarç~oonic~non~ dre~\~ource.txt Page 11 Printed 1~:08 10 Apr g5 continuously. *
PaY -ter~ : ~idget w Wid~et client_da~a XtPointer call_dat~
* Function~.~alled : pro~t) * Return~d ~alue : No~e.
* ~lobal Va~ les : w~rk_i~1, work_id, ~pp *
* Modified ~ariables: work_i~l Author : lC4Vi~ ~avi * ~ate : ~nu~xy 11, 19~5 ~t ~odifications Hi~tor~ :
Co~yright! Panor~mlc ~iewing Sy~tems Inc. *
**~*~*11~tt~1~ 1r*~1r~#~**~*~*~***~****~*** *t~r **~ *1~*l~*****~****1th/
void start~w, ~lient_data, call_dat~l Wid~et w;
Wid~et cli~t_data ;
XtPoin~er ~ ea ;

~* Close tl~e ~i~log widget ~
X~ tLild(client_data) 7 J~ stop th~ woxk_pro~edure whi~h i~ r~nning curr~ntly (o~t~in~
~ L~p~t i~a~e~ in a loop~
XtR~ c~kProc(wo~k~idl) :
i* Add a new work p~ocedure which start~ t~e warplng work_~d = ~tAppAddWo~kProc~app, ~ro~, NULL) ;
}

**~*~ ******~ *** *~*****~*~ * ~ * **-* * ~****~***1 ~ '~ A ~ ~
Function : ~topt) *
* De~cripti~n - Call back routine ~or ~Op ~utton i~
~ t~e user i~er~ace. Stops the w~rping * and open~ a ~ialog window to que~tion *
* the u~er whether reselection of ~ ~ete~3 * i~ reguired. Input im~ge is still o~tained. *

b Parameters : ~id~et w ~id~et ~lient_data *
XtPointer call_data ~n~iong Called : procl~

2147~33 e:\pvs~oftware~conic~non~ dre~ource~txt Page 12 Printed 11 08 10 Apr 95 * ~ ~
RQtur~d ~ra~lle : ~one. *
Glob~l ~riable~ ork_ld, w~rk_idl, ap~ *
* *
* M~dified ~ariable~: work_idl *
* , *
A~thor : ~avita Ravi *
Da~e : Janu~ry 11, 1995 ~odi~icati~n~ Hi~tory:
Copyri~ht: ~anorami~ Viewing ~y~tems Inc.
~**l~*~ ~*~*~**~*~***~~ l*~tt~**~*~*~rti**1~ r*~ t**f~*~
void stop (w, clien~_d~ta, call_data~
Widget w j Widget clie~t_data XtPointer c~ data ;
~ RemoYe the current work proce~uL~ ~warpin~ *~
if ~ twork_~ d j {
XtP~ ~iiW~kProc~work_id~ i /~ Open ~ ~uestion di~bog xtM~na~echii~(client-a~t~ i }
~ ACld a r~ew worlc proc~lure ~just obt?7nin~ the i~put i~age~ *J
work_idl = !~t~ppP~ L-kProc~app. pr~Jcl, NU~
.

~ *****~*~ri*~**~r***~*~ll~Jr~**l~tl ~*711 *ll~***q*~**~*~**~e**
* F~nction re~ize ~ ~
* Descrlpticn : ~e~ize~ ~he corresp~in~ dr~w-area wid~et.
* . ., ~ Parameterg : Widget w *i~t ~lient_dat~, 0 - draw_areal ~1 - draw_are 2 *
*XtPoin~er c~ data *
* Functions C~lled : resize_ image( ~ *
Retu~ed ~alue : ~one.
*
Author ~ vit~ Ravi ~ ~ate : J~nuar~ 11, lgg5 % Modification~ ~istory: *
* ~opyright Panoramic viewin~ Sy8te~s Inc. *

-e: ~pv~oftware~conic~nonxil~dre~o~xce txt Page 13 PriLted 11:08 1~ A~r 95 *~***~*****t~*i***~-~*~****~*******~*~*~t~*~*~*~ ***~**~
.
~oid re~i~e(w, ~lient_data, ~all_d~t~
Widget w ; .
int clie~t_data ;
XtP~i~te~ ç~ a~a ;
r ~; -nC;on ~idth, hei~ht ~* ~ew wid~h M~d hei~ht of widget */
int ~ = O i Arg arg~[10l i ~* hrg~nt li~t *1 int ~hich : ~ ~aria~le to determune the c~lling widget */
whieh = ~l~ent_ddta i f* Get the new width and height *J
~tSetArg~a-gs[nl, XmNwidth, ~width) : n++ ;
X~Set~rg(a-g~[n3, XmNhei~t, ~h~i~ht~ ; nt+ ;
Xt~et~alue,~w, ~rg~, n) ;
J~ Functio~ to resize ~he cont~nts of the widget, namely the i~a~e I bein~ d~played.

resize_imagelwhich,wldth,height~ ;

~*1~ 11**1~ *~lt~;*1~t3r1lr1~ ** A*t***~******~t *1~1~*tr*** *~***~* ***lt~-.~*~*~*~****~ *~
~ Fun~tio~ : redraw~
,~ *
* De~cripti~n - ~edr~w~ the ço~tent~ of corre~n~in~ ~
* . d~aw-are~ widge~. *
", Pa~ P~ter~ et W *
int client_dzlta, O - draw_areal *
1,- draw_axe~ *
* . : XtPc~inter call_aata *
* Functi~n~ Called : ~edr~w ' n~ge ~ ) *
* Returned ~alue : None. *
Author ; ~ t~ P.aYi *
~ Date ~ : January 11, lg95 * ~odificatl~ns History * *

Copyright; P~no~a~ riewing Syl;te~ Inç
1r ~
*~**~***~* I**t~:~**-~*~*~*~**~*~*~*~*~***~***~******~**/
~oid redra~(w, client_~Qt~, call_data~
Widget w , .
int cl~e~t d~ta ;
XtPointer call_d~ta;
i~t whieh ; ~ ~ari~le to d~ermine the ~lling widget 21~7333 _ e~ oftware~cc>nic~ dre;;~ource.txt Pa~e 14 Printed 11:08 10 Apr gS

wbi~h - client_data ~
/~ Functi~n to re~ra~ the content3 of the widget, namely the image * being di~played.
~J
redraw_i~na~e ~which) }
I t~****** ~ ~1***1****~*~*~*~**~-~*~**~*~*~**~*~*~***~**
Function : poaition ~ ~ *
* ~
De~cription : Set~ the p~ition of the dial~g wid~et f on ~creen when mappe~.
* P~rameters : ~idget w *
in~ ~lient_data, O - dialo~ *
* 1 - ~ue~tion_*~flog *
~ : XtPointer Gal~_d~t~ ~
* *
* Function~ Called : None *
~ Returned v~lue : ~one.
* *
* A~-th~r : ~aYiea Ra~i r Date : ~u~xy 11, l9~S
MoCli~tcat~on~ ~iReory:
* Copyright: Panoramic Viewin~ Sy~te~ Inc.
` *
t*~******~*l~*~**~**~********~***********~**~****************~***A~**/
vsid ~ ~itionlw, cl ient_ ~ ta, call_data~
Widg~t w ;
nt c:lient_dAea ~tPolnter call_data ~t n, whiçh;
Arg w~rgsl~01 ;
J~ Determine the ~ g widget *~
which - client_data , f~ Set x position *J
n = 0 , x~se~g~warg~[n]~ 22~); ntt ;
~ S~t y p~fiitiO~
if(~hiCh == 0~
XtSetArg(warg~[nl,XmNy,lg0) ~ n~+ ;
else XtSetArg(wa~g~[~],~m~y,80) ; n~+ ;
;

21~7333 -e:~p~software~conic\non~}l~dre~our~e.tx~ Page 15 Printed 11:08 lO A~r ~S

X~etValue~ ~, wargs, n~
} : :
~**~*~ ~t*~*A~*~**~***~**~**~**********~*********~
~ Fun~tion ~, : get_data~ *
~ , ; , ~
Descripti~n : Call back ~outine ~hi~h handle~ bu~to~ pre~s , iEvent~ in widget draw_areal. The fir~t ~ut~on *
pres~ ~et~ t~ center of the cone, and prompts *
t~e user to ~elect the inner radi~. The *
* ~econd pre~ 6et~ ~he '~ner radiu~ and prDmpts *
t~e ~ser for the outer radius. ~he ~hir~ *
* button pre~s ~ets the outer r~diu~, ~reates *
* the lookup table, a~d notifie~; the user * ~ ~n~n done.
* ~ A ~ri~ble coun~ eL-.- ted ~or *
; e~h ~utton pres~, to identify which parameter *
~ ~elccted and i~ se~ k to ~ero, A~er the ~
* ~ &electio~ f outer xAdius. *
A
* P~r@meter~ . ~idg~t w *
idget client_~ta *
. ~tPointer call_data *
* Pu~ctions~Called : det_center~ et_~ad(~, ~reate-tA~let~ ~
Retu~ed ~alue : ~one. *
.. ..
* Aut~or ~ ; ~Yi~a Ravi *
*
Date . ~anuary 11, l9gS *
* ~odificat'ons ~istory :
* ~op~right~ Panor~mic Viewing Systems Inc.
*
~*~,~****~**~*~**~**~***~**~*******~***~***~******~***1****~*****~**~
void get_datatw, clie~t_ dhta. call_data~
Wf dSJBt W
Wid~t ~lient_data;;
XtPosn~er ~ data ;
~tatic int c~unt = 0; i* Variable to keep track of button pres~e~ *~

XEvent *e~en~ ;
ni~:play *~py l~t C_x, c_y , ~* 2~ point ~f butto~ pr~ss Arg wargstl~] ; I* Ar~ument List *J
int n.;
X~Strin~ ~ string XmDraw~n~eaC~llbac ~ truct *cb~

/* ~et the~y~e of e~ent ~/
cb~ = (x~Drawin~Are~callb~ckstruct ~) call_da~z 21~73~3 e.~p~s~oftw~rè~conic~on~il~dres~o~rce.txt P~ge 16 Printed 11:08 iO Apr gS
e~ent = cbs-~event , dpy = e~e~-~xany~di~play 7 if~cbs-~re~on =- XmC~_~NPUT~

~'~If event ib bu~ton press do the following if~even~-~x~ny.type == ~uttonPress) {
~ ObtaLn ~he ~D po~ition of b~t~n pres~

c_x -.event-~x~utton.x ;
c_y = eve~t-~x~utton.y :
~ fir~t buttvn ~res~ *~
if~coy~t ~- 0~ {
Se~ t~e center of the con~ ~J
~et_center (~_x, c~r);
~unt~;
J ~ Pron~ he u~er for inner radiu~ ~ J
xm_string = X~StxingCreateLocali~ed~Select i~ner radius of c ! n c o i SetArg~warg~i~n],r ~ ~s~a~eS~ring,xm_~eri~g) : nll :
', XrSetVal~les~cliellt_d~ta,w2~rgs,n) ;
Xm5tr;ngFreetxm_~tring~ ;
}
/~ I$.~econd ~utton press ~/
el~e if(count == 1) {, ~ ~ Se~ t~e inner ~dius * /
se~_rad~c~, ~. 0~:
co~r~t~;
J * Pro~pt ~or outer ra~iu~ *~
xm_string = XmStrin~Creat~Loc~ ed~"$e1ect outer radiu~
n = 0 ;
XtSetAr3~warg~ ~n] ,XmNme~a~eStrin~,x~ strin~ ;
nt~ ;
XtSet~alue~[client_adta,wary~,n~ :
, XmStringFree~xm_strin~ ;

/~ If t~ird ~utton pre~
el~e i~count == 2~ {

Set ~uter r~di u~
~et_rud (c_;~;, c~y, 1) 21~7333 e:~pvs~of~ware~coni~nor~il~dres~Eo~rce.txt Pag~ 17 Prin~ed 11: 08 10 Apr 95 J~ Reset the variable ~J
cbunt = O;
J'* Create the lookup table *~
c~eate ~able ~ ) :
I /* Noti~y ~hen th~ table i~ done ~
j xm_strin~ = ~mS~ reateLo~A~ize~l"Lookup table Crea~e~, ca . n = O ;
XtSetArg~wa~gs[~ 3saye~tring,xm~string~ ; nl+ ;
~Se~alue~clien~_~ata.war~s,~) ;
X=Strin~Freelxm_stri~g~ ;

J1~ i~***~*~1t**i******~ * *~*~*~*~ ***71~***~r**~***~***~r*********~***
* Punctivn : y~ ~roc~
~e~cription : Call back roUti~e for ~he ~ye~ bu~on * i~ the ~e~ion_di ~log.
* Parameters : W~dget ~ *
W~d~et client_data ' XtPoin~er calL_data *
puncti~nB Called : N~ne *
ed value : ~nQ. t Author ' : Ravita ~avi ~ate . : January 11, 1995 Modificat'.ons History *
Co~yright: P~noramic Viewi~y Systen~ Inc~ ~
~**~*~f~r*~********lt~f~,**~***~**~*****t~,**f*** j*~l***~*~J
void yes proctw, cli~nt~ a, call_datA) idget ~;
W~dget client_dat~
XtPoi~ter ~ d~ta ;
i~t whiah,~n ;
Arg w~r~[~0~ ;
XmString x~_~tring ;
~ Close ~e *i~bog w nd4w */
XtU ~eChild Iw~ ;
Open a new ~ g ~indcrw prc~n~t~
the u~:er for cone paramet;ers ~ I

21~7333 e:~vs~software~conic~nan~ dr~ ource.txt Pa~e 1 Pri~ted 11:08 10 Apr 9~ ~

xm_~trin~ - XmSt~ingCFe~t~Losalizedl"~elect center of the cone" ~ ;
n = 0 , XtSe~Axg~w~gs~n3," '' ~eStringtx~_c~ring1 i n~+ t XtSetVal~e~client_ da~a, Warg~,n~ ;
Xr~qtrir~Pree ~xlrL_strir~) X~M~ r.h ld{client_~iata] ;
} , .
/~1*******~***r*~*~**~*'.~*t*t***~********~*~*~
* Functio~ I : ~o_proc~) *
~e~ ti~n ; Call back rou~in~ for ~he "no~ b~tton *
i~ the ~ue~tLon_~s~lo~. 1 ~ P~r~meters : ~ldget w *
Y ~idget client_data * ; X~tPointe~ call_data *
Function~,Ca~led : ~one * Re~ alue : ~one. *
* Author : ~a~ita ~avi ~ DatOE : Janu~ry 11, 1~5 * Modific~t~ons Hi~tory : *
t Copyri~htt~ Panoram~c Vi~wing Sy~tem~ Inc.
~*~*~*~t~ ~**~*~t**~**~*~*~*~**-****~*****~*~**~****~
void no_proc~y clie~t_d~t~, c~ll_ d~t~
Wid~et w j XtPointer client_data ;
XtPointer call~dat~ ;
Xt~ e~ hild~wJ ;

/***~*~***~*~**~*****~****~******~**********~******~***~**~t,~
Function : load~private_cmap~
DeEcripti~n . Installs a private colornap.
* *
~ar~metram~t~ play ~dl~pl~y olormap c~ap . u_char r. gr b int map_langth, hength of color~ap ~ int offset, Off~et in~o colormap *~ ~unc~ion~.~alled : ~etYiewportcolormap~)~ *

* ~tur~ed ~al~e : ~one.
~ Author : A'~rgio Licardie e: ~pv~softw~re~conic~n~nxil~dres~cour~e-~x~ Page 19 Pri~ted ll:~g 10 Apr ~5 ~ate : July 1~, 19g2 Modific~tions Histor~:
~*~ ***~***1~*~****~.tt*~**~ *~*~*.'~*~,t~*~ltt~ll*l~*~tt*
~oid load_privat~_cmsp~di~play, map, r, g, b, ~ap_len~eh, offset) lay *di6piay;
Colormap ~.~p;
u_char kr, ~ b:
int ma~_le~gth, 0~8~t;

Status r~;
regi~te~ int i;
u_long ~ixel~t~61, plane_~a~k~[256]:
XColor colors[2'6];
~oid ~etYiewportColormap~ ;
f~ Alloc~te ~56 cell ag~in *~
rc = XAllocColorCe~ di~play, cma~, Tr~e, plane ~ , O, pixel~, 256);

J* If XAllocColorCell~ failed, retur~ a f~il~re ~J
if~!ro) t printf~XAllok for priv~e ~p ~ailed ~n"~;
r~turn; .

f~ No~ ~et ~he Yalue~,of the colour aIr~y for(i-O, icm~p_length. illl .
coior~ [Ll .pixel = i t of~et;
oolors[i] .red = r[i~cc8;
~oior~til .green - g~i]cc~;
colors(i~.blu~ - b[i]cc8:
~ol~r~ la-s - DoRed ¦ ~o~reen ¦ DoDisplay nd ;
}
~* Free the ones we don' t need tj if~offset~ .
{

~ Pree window l[anaS~eX color~ ~f fo~ O; icoffset; i+~
p~xel~
XPreeColor~ ~d1~play, cma~, pixel~. offse~, C~;
f ~ ,Pree color~ at the top of the map for(i-(o~f~3t~ length~: ic156, i~) p}xel~ ti- lof F~et ll[~ap_l~angth} ] = i ~PreeColor~ (di~play, am4p, pixel~, ~5~- (orf ~et~map~lengthl, ~;

: 36 e ~,v~\~o~tw~re~eo~ic~on~ ree~Gc,~r~e.txt P~ge 20 Printed 1~:08 10 Apr g5 /* Store it in the co~our ~ap '~
XS~oreColo~di6~1ay, c~ap, col~rc. map_len~th);
.~ctYLcwportc~l~rm~p~dlsplay, D~faultScre~n(display), De~aultVi~ual~di~play, DefaultScree~di~ y)~);
XMapW~n~ow~display,~rc_win);
~ Now i~stall it in t~e h~w~re Xln~ta~lColorm~p~di~play, cmap);
return:
}
~ **~ ~*~ ~****~*** * **** 11** * *** 1~*** *** **** ~**~: *** A *~*~* I ** I i ** t~ ****~r***~*
;
eunGtion : l~ad_defa~ m~p~
* De~c~ipti~n : ~y to allocate read~write ~ell~ rom ~he *
defaul~ color~p. Se~ the o~et into the colormap * P~r~m~ter~ . ~ 6pl~y *~i~pl~y *
r~ , cmap ~ha~ *r, *~, ib . int ~a~_len~th, ~en~th o ~olormap int *off~et, Offset into colormRp Punctionc'Called : N~ne.
Returned ~alue : 0; on ~ucce~ *
-~ Dn failure *
~uthor : S:rgio Li~ardie *
P~te : J~ y 17, lg92 * , ~
* M~A;ficAt~on~ to~y :
* , ..
*.t~***~****t~**~***~*~***~*~*~ **~***Yr~*****I****~****~**~
~nt ~4~d_defau_t_c~p~d7s?1ay, cma~, r, ~. b, ~ap_len9~h, o~fset~
Di~play *di~p-ay;
Colormap cm~p;
u_chRr *r, *g/ lbi Lnt ~ap_length, ~off3e~;
StaStaS : - rc;
regi~ter i~t i;
u lmng p:xel~2563, ~lane~na~k~[25~;
XC~D1Or C:O~OX6 1256};
rc = XAlloc~o~or~ellsldispl~Y, cmap, 'rrue, plane~ k~, 0, pixels, maP_length~:
~ * r~ XAl~ocCDlorCel~ ~iled, ret~rn R f~lure *~
ift!r~}
ret~rnt-1);
if(~ixel~[0~lmap_l~n~h~ pixelslm~p_length-1]~

`- 2147~33 e:~p~oftware\conic~n~n~ dre~\~ource.txt P~ge 21 P~inted 11:08 10 Apr 95 ~*
The map re~rned wasn't contigoua.
A Free ~ e cplors returned in pixel~.
e Return a f~ilure.
*~ .
XFreeC~lor~di~play, c~p, pixel~, map_length, 0~:
~et~

~* ~ow set the vaLues of the colour array tJ
fo~ 0; icm~_length; i~+) eolor~[il.pixel ~ els[O]
colorg,i~.red - r[i]cc8;
~olor~ ee~ = g[i~c~8;
color~:i].blue = b[i~cc8;
colors i] . fla~s = DoRea ! DoGr~en ¦ DoDisplay nue;

Return ~he value o~ off~t to the user ~J
~offset = ~ixels~D~;
f~ Store it Ln the colour map ~
~S~oreColor~tdisplay,~c~ap, ~olora, map_length);
returnt);
}
f**~*******~**t**********'****~***l******~***~*~****~***t******~***~***~*
~ Punc~ion .'load_colorm~pt~ *
* Description , ~ry to ~e de~ault color~ap, if not set up a prl~at~ colormap for the X dis~lays. *
Par~meter~ : u_char *r r *~r ~b *
~ ibt length, Length of colormap *
Func~ Called : lo~d_default_ca~p~), load_priv~te_~a~p(~. *
Returned value : ~one.
Global Va~iable~ : currenc_cm*p, 3rc_di~play, = p $
* X~difiea ~ariable~: curren~_emap, c~ap ,~ . i ~
A~thor : ~ergio ~icardle * Date Jul~ 17, 19~2 * ~o~ ati~n~ Histor~ :
*~**~**~**~*--*~*~ ~*"*~ **~*~*f**~*~*~
void load_color~aplr~ g, b, def_c~, pr~v_~ap~
u char *x, ~, *b : ~
Color~p ~ef_cm~, priv_~map .
int wm_o~set~ f* Of~et in~o the celormap - 21~7333 e:~p~ soft~are~conic~onxil~dres\source.txt P~ge 22 Printed 11~0~ 10 Apr g5 if (current_c~ap =~ priv_ cmap) ~U~i~tallColo ~ p~ BIC_di8play, priv_~map~;

eurrent_cmap - def_c~p ;
cmap = O ; /~ Lefault colormap i~ u~ed *~
i~ ~lo~d_d~f~ult_cmap~src_di~pl~y. def_cm~p, - r, g, ~, NCOLORS, &~_o f f ~et ) c f*
Can~t u~e l~he *efault nA~ n~ else * ia h~ggi~ it use our own pri~ate map.
*J
prlntf ~Ucin~ pri~ate color rnAp ~n''~;
cuxren~_~m~,= pri~_cmap;
cm~p ~ 1 ; ~* P~i~a~e ~olor~ boing used wm~off~et = Q ;

~o~d Drivate_c~p~sIc_di play, pri~_c~ap, . r, ~, b, NAXCOL~RS, w~_off*etl;
else prin~f.~u~ing de.'ault ~olor m~p ~d~,wm_offset):
return, }
;

J ' lt ~ Function : ietViewport~lorm3p~) ~
* Le~cription : l~hia se~s the colormap an~ WU_COLORMAP_ wlNuow~ ** pr~perly for the YiCWpOrt.
* P~ramet~rs ~ la~ ~disp *
* ~ ~reen scnn *
~'isual ~vi~u~l *
* Functio~ Calle~: ~one. *
F.eturned ~alue : ~one.
~r *
* ~lo~al Variable~ : fr_xid, curr~nt_cmap *
~ Author : ~ ergio L}carai~ ~
* Date - : ~uly 1~, ~9g~ . *
* Modificatao~s ~i~tory :
~ 1r1r~1r1r*~*9~5il** ** 1~ * i ~* A **** ***~***~1~ '~* *** ~*1r~1t~e~ ***~i:/ J
~oid setViewportColormap~disp, scrn, vi~u~l~
Disp~ay ~disp ~nt ccrn;

2147~3 e: ~p~e~6oftwA~e~3nic~n~tl ~dres~o~r~e~tx~ PagOE 23 Printed 11:0~ 10 Apr ~5 Vi~ual Irvixuai;
xsetwindowAttri}~te~ swa;
static ~map_atom= None;
Window cma~_windows E21;
if ~cm~p_atom -- Non~) cmap_atom - X~nternAeo~disp, ~M_COL~R~_Wl~DPWS~, Fal~e~;
J~ if ~he ~is~al we'~e ~ing i~ the ~ame as the ~efdul~ visu~l ~used by the viewport windo~ t~e~ we can set the viewpore window to use the ima~e~B ccloxm~. this keep3 mo~t winwindaw ~n~ger~ happy.
*~ .

if ~ ual __ Defaulqvisual~di~p~ BC
~.c~lor~p- ~uLLe~ om~p;
XChan~eWind~yAttributeg~di~p~ fr_~id, CWColo~p, ~swal;
XD~leteP~operty~di*p, fr_xs~, ~m~p_ atom~;
}
/~ ~mart window m~na~er~ ~n h~ndle it wh~n ~e use a different colormapi in our ~ubwindow ~o long a~ we ~et the ~ff-coT~o~Map-wLN w..~ p~ope~
* aLa I~CC~. ;
~J
else cm~ ndows~ rc_~in;
cmap_windo~ r_xid;
x~h~n~QpLv~eLLyldi3p~ fr_xid, c~p_ato~, XA WIMDOW, 32, : ~O~llodePr ~****~* r~rsr*frf~*frfr*~rfr~*~**t~ **~lt~ ~**~**~k*~b**~;r*sr~*s~1ry~r~rfr*f;t~r~l~l**l~i~
.
~tatic char rc~idl] = $~d: ~ther c,~ 1 1 1~9~/02~28 21:32:36 ka~ita exp k~vi~a $~
Jf irfrfr-$*l*~e* **~** l~rl~*~e*l*st**tl~**********~t**~fr**tr*frf~f~fr*~***~r**~****~r2r**~
* ~ 1r ~ File : dither.c i~
* ~
* D~scriptlon : This file c~ntain3 ~he routine6 for bfw dither.
* Th~t~ routi~ h~ve ~Qn ad~ed from th~ ~v f-f ~ource code. ~' * Fu~tion~ ~oid InitSpline~ *
* dou~lé Ev~lSpli~e(~ *
~ ~oid ~ PloydDitherizel() tr *
~ ~uthor : ~it~ ~i *
* : ~
fr D~te : Ja~ua~ 9g5 Modification~ Histo~y : 1r * Cop~ ht: pAnoram~!c viewin~ S~ems TnC. *
***** rf *******-A***irt~r**~rtr**~r~r***t~r*~r~frfr*~***lr**fr**fr~fr***~r*fr*~r~r~*lr*~c~**~t*/
~in~7ude ~XllJXlib.h~

2147~33 -e:~p~s~o~ e~c~ic~nonx~l~dres\so~rc~txt Page 24 Printed 11:08 10 Apr g5 ~*~--~*~r***~*~*~***~*~,**~**~**~*~**~*~*l~ I~I**~*~*Y~
* ~unction : ~nitSp~ine~) Le~cription : ~iven ~rT~ys of data p~ints x[O.. n-l] and [O. .n-11, COL~ the v~lue~; of the ~eçond *
oexiv~tive ~t e~ch of the data point~, *
y2~0..n~
Paramete~ : ~t ~x d~t~ ~oints *
* i~t ~y * i~t n num~er of point~
dbub1 e ~y2 ~econd derivative *
~r F~nctio~s C~lle~ ~one. *
P~e~u l.ed ~alue : ~one. *
* ~ 1r ~uthor ~hn Br~dl~y Date : *
Modification~ Hi~tory . *
~ , *
~ Copyright. Panoramic Viewing ~y~tem~ Inc.
1~ *~*11 ll~t* A ~ A A-t ~1~ilr%1r~ J~ll *~'k* ~ 1~ A 1~* 1~'~1 *~ *~ 1.** ti*~ ~* * ~*~* i~**~* ~ **~ A ****~
v~id Ini t ~;pl ine ~ x, y, n, y~l ) int ~x, ~y, n;
double *ya i in'c i, ~c, `
dou~le p,qn,~i0,un,u['16~;
~[0~ - u[O] e ~.0; ,' for fi=l; lcn-1; it~
~ig = ~ ldouble~ xri] -x~ dou~le~ x~i+l~ - sti-l]);
p _ ~;ig ~ y~ ti~ 2.07 y2 [i] ~ h-l.O) ~ p;
u~ do~le~ y[i~ y[i~ x~ ]-x[i] ~ ~ -(~double~ y[i-~}) ~ ~X~ X~i-ll)~;
u[l] - (6.0 *~ u~ x[i~L~-x[i-l]) - 3ig~uEi-ll~ ~ p:
}
= tm = o . o, y~n-l] = ~un-~u ~n-2] ~ n~y~ [n-~ ] +1. 0);
for ~k=n-2; k~-0; k- ~) y2tkl = y2[k]*y~ Lk+ll tU ~k~;

* * , ~ . *
Function : ~ alSplinel~ *
De~c~tion : Evaluate~ apline function at given point Parameters : int xa~]
int yat~

21~7~33 -OE;~pvs~oftw~re~conic~non~il~dre~;~source.txt P~e 25 Printed 11: OB io A~r 95 ~r double yZa~]
~t n *
dDuble X *
Fu~io~ Cal 1 ed : ~one . *
~ , *
~etu~ned Vi~lue ~ uble. *
A
1r Author : ~ohA Bradley f L
~ate *
Modific~tion~ Hi~tcxy *
Copyright: Panoramiic V7 ewinST Syst In~ . ~
*
**~*~****~*I*~**~**t~*~**~*******~**~***~**********~**~ry*~*f double ~3valSpline {xa, ya, ~,~a, n, X) dou}~le y2a [ ], x';
nt~ n,xa 13 rya t ] i int lclo,khi.k, d~uble h, b, ~q r ~clo = Q
l~hi = n~
~hile (lchi ~c~ o ~ 1) k _ {khi~klr~
if ~x~ [k]
khi = k;
else klo = k;
h = xa lkhi3 - xa lklo~;
if ~h~ . 0~
printfl-Bad xYal~les in ~plint~n~;
~ kh. ] -x~ lh;
b - ~x~xa t~ ] ) Jh;
r~turn ~a~yd[klo] ~ b~y~rkhil I ~{a*a"a~ y2~[klo] ~lb~b*~b)~y2a[1~hi]) ~e ,(h~hl ~ Ç l;

~ *~i***~**~***~ r~*1r~ r~ r~****~r~***$t***~*~*~$*****lt*******
* Function : ~loydDitheri~el ~ ~ *
* I:e~cripti~n : ~erforms ~lc~-g~ein~erg di~heri~in~ 1r ~lgc:rithm.
P~ra~te~ nage *xi~:nage XImage for di~play *
* ùn~ igned eh~ * inima~e ~ e ~nt wide Width of irnaye tnt high ~ei~h~ o~ e Function~ ~al~ed : ~nitSpline ( ~ . *
* ~v~lS~l ine ~ ) .
e * Reeurned Value : None.
Author : John Br~}ql~y *

2147~33 , e:\~v~oftware~conic~onx}l~dre~ou~ce.txt Pa~e ~6 Printe~ 08 10 l~X ~5 * ~ate : *
* *
~ ~odi~ic~tion~ Hi~tory : *
* ~
Nodified b~: Kavi~a Ravi t D~te : J~ua~ 5 *
t Cha~ge~ : ~ r of paramet~rs ~f the func~ion ~ve ~een t~ cc;d f rom B ~o 4 .
ter ~ptype~ d ~ss the inE~ ~nage * i~ alw~y~ 8-bit. *
Param~ter~ r~ap, gmlp, bm~p have bee~ re~ved a~ *
~ t~ey a~e ~re for 8-bit imagC.
* The code in~lude the ga~ma Corr~ction cur~e *
F~ ~ [] a~ ~ ~ta~ic variable, ~nd i8 iniei~lized * on the first C~ll to the ~unct~on. ~f~ *
~ u~e~ as a gl~bal variable in the x~ code). *
* *
c~ ght: P~no~amLc ~riewin~ Syfit ~ In~- *
*~****t~*****~***~**f*~******~**~*~*~***$~*~*~*~ ~**~
void Floyd~itheri~el ~i r~ ,piC~, wide, his~h) XI~e *ximage, un~igned char tpi~:~24 j int wide, hiç~h;
regi:ster ungig~ed ch~r p~x8, ~it i ~tatic int count~O;~ Flag t~ identi~ fir~t ~ll to function x J
~tatic ~n~igned char ~sga~r~Z$~3; t~ ~am~ correction cu~re igTr~3 char *p~, ~image, ~g~E~56];
lln.c; gn~d char wl, bl, w8, ~æ
st~tlc int x[ 4] - { O, 32, 224, 255~:
~tiC int y~3 = ~0, 0,25$,2$5};
long int ~hite, ble~k;
int ~thi~line, ~n~t.l ;~;
in~ . ~thisper, *nex~tr, *pnpE~r;
int i, j, e~r :;
ant ~erpix, bperln, order;
double Y~14] r Initi~liz~ gam~a ~orrection Curve, if fir~t call to function ~J
if(~oun~ =- O~
{
InilSpli~e(Xt Y, ~, Yf~;
for ~i~Oi ic256; i~
{

j - ~int~ BvalSpline~x, Y, yf, 4, 1~ou~le~
if ~jcO) ~,=0:
el~e if ~j~255 j:=255;
fsyam~r~i] - j;
}

coun~
}

e: ~pvs;~coftw Ya~conic~n~i~ ~e~;~sou~ce . txt Page 27 priAted 11: 0~ 10 Apr g5 for ~i=O; ~c256; il I ) xgb [ i ] ~

image - lunsign~d c~h~r *) ximage-~ata;
bperln = xi~age-~yte~er_line;
order = xi}llage-~bi~map~it_order;
~perpix = 1; , .
thisline = ~int ~ wide ~ sizeof ~in~) );
nAYtline =i ~3nt *~ malloc~wide ~ ~izeof~int~;
if ( ! thi~lln~ ne~line}
printf ~ ~Erxor in allocating me[nory~n~ ) ;
~* load ~p ~ir~ ' of pictllre *J
pp - pic824;

for (jeO, t~PPtr = ne~tlir~e; jc~ide~ , pp**~
~ t~p~tr~+ - f ~ub~ri[ rgb [ *pp~ l;

bl~k = 1, white = O, wl - white~Oxl; blebLack~Oxl;
w8 - w'~7, b~ - blcc7; ~ bJw bit in hi5rh bi~ ~f fo~ (ieO; i~his~h; it~) {
/~ ~e~ next line ~f ima~e ~

tr~p~r ~ thi~li~e, thisl~ne = noYt} ; nr;
n~rt 1 i n~ = l ~ ~P
i ~ 1 ! =high~

pp = pi~8'24 t (itl~ ~ wide ~ bperpix:
for tj~O, t~llpptr = n~.l in~ wide; j~, pP~
~ ~t~ fsganLcr trs~b [ *pp] ~;
.
thi~pt~ = ehi~line; next~tr _ ~Ytl ;ne;
~p e ~mage ~ erln~
if lorder--I.SBFir~t~
~it - pix8 = O;
~or ~j=O; j~wide: j++, thi~p~r~l, nextptr~*~

thi sp~ 2 e ) er~ - *thisptr;
pix8 1= b~;
else t err = ~thisp~r-255;
pix8 ~ w8;

i~ ~bit==7) {

21~73~3 -e:~v~ioLtw~re~conic\n~nxil~dre~source.txt P~e 2 PrLnt0d 11:03 10 Apr 95 *ppll - pix8;
~it=pixg=~;
}
e;lse pix~
bit+~;

jcwide-l) thi~ptr~1] t= ~ (err*~
ti~high_1~
nextptrEO~ t= ~ (errRS) fl~);
: ` if ~
nextptrr-13 +- ~(err~3)/16);
i~ ( jcwide~l~
ne~ r t 1} ~= ~exrJl~;
}
if ~bit) *pp~t = ~ix8~7-bi~ write p~rtial byte ~t end ~f . . A line e~e I J~ ordcL ~l~rirst ~J
hit = pix _ ~;
~or ~j=O; jewide; jlt, thisptr++, nFytpt~+) thisptrcl28) err c ~thi~l?er;
pix~ l= bl, else~
err = ~ ptr-~55, j pix8 ~- w~, i~ ~bit--7) { ~ptt = pix8 ~ it=pix8-o;

e~e pix8 cc= 1: bit~, }

i ~jcwide-1~
. thisp~r[1] ~ e~r~7~J16);
i~ l Chi~h-1~

nextpt~[O~ += ~terr~5~16);
O ) nextptr~-1] += ~err*~/16)i lf (jcwide-1}
nextpt~[ ll ~= ~err~
}

-~ 45 e:~pv~3~tware~0nic~non~ dres~cour~e.txt Page 2 Printe~ 8 1~ A~r ~5 if tbit) , ~pp~l = pix8c~7-bit); ~ write partial byte at end of ~ lirle ~/

freetthi~l ;n~) ~ree(n~tl ;n~
}
/~***t*~*****l*L*~A~t~t*~t*~*~lr~1~1r~.~r~**~.*~' ~'*t~*~'1r~s`~J

# Author K~vita Ravi ~aee : Pe~ruary 27, 1~95 Copyri~h~: P~noramic Viéwing Sy~te~ ~nc.
$ Use the ~ec ~o~pi7er C:C ~ gcc # Check if the make ~_ - ' ha~ ~f;~ a macros OS
~ If OS - olAri~ then, ?
# u~e a different ~t hf directories to find the include ~iles ~C~LA~S?
# El~e .
* u~e different (CFLA6S) ifeq tS~OS~. s~lari~ , ~:PL~GS ~ -IJu~rt~ 5/;n~luA~ ~ rJ~lR5Jlnclude~pixrect L~BS = -LJu~r~openwin~ L/usrJXllR5Jlib else GI~LAGS = -Itusr~XQ~5 ~ include L~BS = -L~usr/Xll~S~lib -L/u~openwinJli~
endif ~ objQct fileu on ~hich the executable i~ d~r~n~A~t OBJS = ~a~n.o ~arp.o int~rface.o dither~o ~w_ra~.o ~xecutable ~Or any SUNOS ~hi ~Q
o ~ i_W~ $~oaJs) ~ CC~ -o omni_warp $tO~JS) ~Lr~S~ -1~ -lXll -lXm -lXt -lXext -lXmu # Bxe~u~able for S~I.ARIS ~h;nc~
omni_wsrp~ S(OBJS) $(CC~ -o omni_war L 6~1 $~OBJS) $~LIBS) -lm -lX~l -lXm -lXt -lXext -l~mu -l~en main.o: def~.h w~p.4: de f ~.h interfa~e.o: defs.h ~ m~ke clean will ro~eve all the object file~ generated.

clean:
/binf~ i,o 214733~

E: ~PVS\SOFTWARE~ONIC~XIL\DRES\WARP~ C~ lZJ04~95 static c~ar rc~id[~ = "$Id: warp.c,~ 1.1 1995~02~2~ 17:42 kavit~ EXp kavita ~**,t******** ~*** *
* 3~ile : warp~ c *
* De~icription: Th~s ~i~e con~ains the i~age proc:essing routine~
* Eunc~on~ ~ void init ~ lib~ ~
* ~oid remove~ e li~ *
* void ge~ images ~1 *
* void warp{) * void clean up~ *
* void resize_image ~ ) *
~,roid ~e~raw i~age ~ ~ *
Author : Kavi~ Ra~ *
* Date : J~nuary 1~, l9gS *
* ~odifica~ions ~is~ory: *
* ~opyright; Panc~ramic Viewin~ Sys~ 3 Inc. *
~****~*~****~*********~****~******~**~**************~***~*****~*****~*J
J~ Include files *~
~include cxil~xil .h~
~incl~de "defs . h't f*~* ~
E~ernal ~rariables *
* ~declared in main~c) *
* *
*~ ***~*~**********~**~
extern Lnt port; ~* Input ~th;~T~r~l *~
exte~n pixel *~a~le; /* ~ t~le *J
AAA*~ *~*******~**~*~*******
*
Exte~nal Yaria~leE; *
~eclared in inte~face.
****~*~*~*****~***~***~****~
ex~:ern Display *~rc_~isplay; ~* Poin~er to display of inpu~ image ~J
extern ~ pl~y *dest_di~play; ~* P~inter ta displ~ of vuL~L
* ~ ma~e *~
extern Win~o~ src win, de~t_win; ~* X Window Ids *~
extern int cmap: ~ Flag to deter~ine C~urrent * colo~ap - private o~ default */
ex~ern int ~:r~_dep~h : ~ ~ Sc~een depth 21~7333 ` 47 B:~PVS~SOFTWA~E~CONIC\XIL~RES~WARP.~ 12~04f~5 ~**l~L~AJt.~ *~*~t~*~*
XI~ varia~e~; *
1t*~**~*~*****/
XilSyst~State state; ~* XIL s~s~ion *~
XilI~age ~:r~_l~age, deç:t image ~ rations for input an~l oul~lL
* images ~/
XilT- ~ rtvc ill~a~e; ~* Devi~:e Imag~ for g~abbing *J~flT~n~_ Qrc di~ nage, de~ 3,is imaqe; ~'* ~isplay i~a~es for displ~ing * input and oul~ image~ */
~* Images for in~ermediate processing *~
XilI~age sr~_inter_iDIage ~ de~t_inter_image XilI~age i~s~, ~.x;
oln.r ~?le ~or ditherin~ *~
~itK~rn~l ~istrihuti~n a~ colo~p;
~****~***~*~ *~*******
* other varia~le~ ~
*~****~****~*~*****~*~*~
static int mul~ipliers~l} = {-1};
~;tati~ ~nsigned in~ di~ensionsll] = ~BITSIZE~;
int ~;~ width, ~;rc height; J~ S~ze ~f inp~t i}llage *~
int de~t_ wid~;he32e~ deæt_height--240; ~* Size of ~lL~u~ i~age */
~* Scale factors ~or re~ ng input and output images */
float ~rc_sc~, src_scy:
float ~lest~ x, de~t_acy;
t* ~a~ues fc~r re~;caling YCC jn ~s *~
~loa~ 6cal~ ~alue~[3~;
floa~ set_~l~esl3~:
~* Yalues for re~caling gray ~cale i~ages *~
float g va~ues[lJ, o~value~[l] ;

~**~**************~*~***~*** ~
* Function : ~nit image libl) *
* ~escripki~n : Ini~i~li7-e~ i~age libraries, ~-et~ ~he * attr~bute~ ~f ~he grah~ing d~v~ce, all~oates * ~e~ory for the image strucL~Les.
*

21~733~

-PYS\~OPTWAR~ IC~XIL\S~;~ARP C 1;~04f~5 * Parameters : None. *
* Punct$ons Called ; None.
~ *
* R~Lu~.. ~l Value ; None. *
* *
* Extern Variable~ : por~, ** src display, ~rc _ win, *
* dest display, dest win, * src dept;h *
* *
* Global Variables ; s~a~e value~l3, of~:et_~lues~], *
* s_Yalue~:{ ~, o_Yalue~ ~ ~, *
~:tate, src image, dest_imaye, *
* ~ VC_image~ im~eycc, *
;rc_di~ _ im~ge, des~_d~ s_i~a~e, *
sr~ inter i~e, dest inter im;~e, *
* ~rc w~dth, src heigh~, dest width, *
dcst height, src~_s~x, src scy, *
* deæt ~Cx, dest scyr col~rmap, dis~ribu~ion *
* ~
* ~ ie<l Va~iables: scale v~l4es~]~ o~se~ ~alues¢~, *
* ~ alues [ J ~ o_valUQ~
* state, src_ima~e, dest image, r~vc ima~e, imageycc, *
* arc_dis _ i~age~ d~:t di6 image, *
* src~ er_image, de~t_~nter_image, *
* ~rc_wid~h, src heiqht, *
* src_s{~ ;r~_~cy, *
* dee;t _ WX, dost scy, * colormap, die;*ibutiox~ *
* Author : Ka~ita :~avi *
* Date : January 11, lgg~ *
* l~odlf icatl4n~ ory : ~ *
~py~i~ht: Panoramic ~tlewing Sys~ems Inc. *
**~*~A~ *******~**~*~****~*~**~ A~l~******~*~*******~******/
ini~: image_l ib ( ) ~nt ~m~ge~ ; p -- O ; /* Image frames to ~kip ~etween * ~:apture *~
int ~x _ buf~ers = 0; f* Maximu~ ~ra~es to bu~i~er ~f cn~ devna3l1e = NIJLL; /* Name of r~vc device *~J
int Wid~h, heigl t; /* W~dth and he~gh~ of ima~e *~
~ nt; nh~nt3~ * Numbe~ of bands of an ima~e *~
flo~t v~l[lJ:

Xil~aType datatype ~ aLaL~e o:E XIrr image *~
XilC!olor~pac~e ycc, y ~ olorspaCe o~ XIL i~aqe *f /* Values c~ YCC iInage need to ~e rescaled from 1~ - ~35 21~733~

PVS~SOFTWARE~:O~ XIL~aES~,WARP.C 12,r04/95 ~ ~o 0 - 255 *~
scale ~alue~ [ 0~ = 255 . 0J (235 . 0 - 1~ . o) s~ale val~ a 255~0 ~ ~240~t3 ~ 16~0)~
~c~le_~luest2] = 255.0 ~ ~240.0 - 1~0~;
o~;et - values[o~ - -16. 0 * ~cale_~lues~0 offset~ralues ~ . O * scale_value~
of~;et_~ralues[2~ c -16.0 * soale_values~2;;
~* Va~u~: o~ grayscale image need ~o b~ re~caled a~cording to * csolor~ap o~i~8et *~
s va~ues[o~ = ~float) ~NCO~R~ floa~ ~B~rESI~
o_value~1~ a tfloat~ O~ss -- NCO~4RS~:
valtO] = 0.0;
~ nitiali~e XI~ libr2~ry *f s~ate 5 xil :open ( ~ ;

printf ( Er~or: opening xil library~n" ~ :
exit(l);

~* ~reate device iDIage for ~apturing */
f( ! ~rtvc ~mage = ~cil create from_device(s~ate, "SlJNWrtv~ vc~id devname~
~rintf ~ or: falled to open S~NW~Yc device~n") exit ~
}

~* Set aLL~ al~es of the rt~c devi~e image */
xi~_set_deY~ce_~ttribute~3~~vc imi~ge, nPORT Vn~ (void *~ po~;
if ~age _ sk~p) xil Bet_ devic~ attri}~ute~r~vc image,~lIr~G~:_S~P", ~void ~)image_~kip~;
if ~max buffers) xil_s~t ~evice at~ril~ute lrt~ ima~e, "MA2~ ~S1', (Y~i~
~ ax_bu~er~;~ S
xil get in~o~rtvc i~2~e, ~width, ~he~gh~, ~n~n~ datatype~, f~ C;r~ate a ~CC i~age ~J
i~age~cc = xil cre~e(f;tate~ width, height, nbands, datatype) ycc = xll_~o~orspace_ge~_by name~st~te, ~y~601~ :
xil se~ colo~space~ c, ycc);
J* Widtll and~ height of inp~t image ~

Paqe 4 E: ~PVS~SOE~ARE~CONIC~\XIL~RES~WARP. C l~J04J~5 ~;rc_width - width: src_height = height;
~* create the inpu~ grayscale XIL inage *J
~;r~ age --xil_çreate~st~te, src_wid~h, e;r~ height, 1, XIL B~TE~;
y -- xil_color~;p~ce get_by name~tate, ~'y~01"3:
xil_set oolor~ e ~src i~age, y) /* ~reate output XIL image *~
des~ i~age - xil_c:rea~e(~:tate~ des~_wic~h, de~t_h~ight, 1, XIL ~rrE);
if (src_deptli =-- 8) de~_inter .image - x~ 1 create~state, de~;t width, de~t height, 1, XIL BY~
xi~ et va~ue~e~:t_~n~er_i~age, val);
~:r~ inter ~mage = xil_create~s~ate, src wi~, src_height, 1, XIL_B~E ) /~ If bJw ~creen initialize lvoh~p ta~le fc-r dil~hering operatione *~
else if (src_dept~h --- 1) distri~uti~n = xi~ kernel_~et _ by name~ a~e, "floyd-stein~ergn~;
colormap --'.xil _ colo~e _ crea~e~;t~te, XIL BI~ L _ I}YTE, 1, ~ul~ip~iers, ~ sions~:
/* C~eat~ X:rL d~;play iraage~ *~
~rc _ diC i~age - xil crea~e _ f~ro~ windo~re a~e, 3rc displ~y, src win~;
dest_di~ ge = ~il_c:reate ~rom_windowt~tate, des~ AY~ de~ win1;
xil_get_inf~src_di _irage, ~width, ~hei~h~, &n~ands, &data~yp~);
/* obtain sa~le Tactor~ fo~ ~esiz~ng ~he i~ges ln order to display *f ~rc_scx ~ ~ no;~t) width~rc_width ; ~:rc c~y = ( float~ height~:~rc_height ~f t 8rc dep~
~c~inter_~age = xil c:reatetstate, ~idth, height, 1, XIL_E~YTE);

xil_~et_infc~des1~_dis imzlge, &widtl, &height:, ~nh~nt~:, &d~t~ype);
de~ ;cx ~ c~ wid~h~dest_width ; dçst_scy - ~loat~ heightJde~t_height :
if ( src_depth --= 1) dest_inter ii~age = xil_create~state, wid~h, height, 1, XI~ BY~), xil_set_Y~}ùe~des~ in~e~_image, val~;

E:~PVS~SOr~ CONIC~XIL\D~ WARP~ Ç 12/04J95 xil_~tate_~et_~ e (~tate,l~gUE) }

~*~********* * *
* Function; c:lean up ( ) *
* Des~:ription: Flushes the fra~e buffer~ ~efore nex~ uLe ** of ~n image. *
* *
* Para~eter~: None. *
* ~unc~ion~ ~a~ None~ *
Re ~ .1 value : None . *
* Glchal ~arii~le~;: rtvc i~age *
Author : Kavita Xav i *
* Da~e : January ll, 15195 *
Mo~i fic~:~ti~ns E~s~ory :
opyri~h~: Panora~ic ~iewing Sy~:~ems In~. *
*~*******************~*********~*****1~ **~**~**************~*~****~~ro~d ~lean up ( ) int set c o Yil_ set_device_attribu~e(rl;vc_ima~e, ~FLnsH~ r~ (~oid *~set);

~****~************** *
* F~ ;ion : get_images ~ ~ *
* Description : ~aptures i ~ from the rtvc ~ ce, co~ver~s *
* the ~C ;m~ into grayf;cale, ~d display~ *
* ~h~ image.
Parameters : None. *
*
Functi4n~ ~alled : c:lean_up ( ~ ~ *

~e ~u~ ~lue : None. *
Extern variiAhle~ map, ~r¢ dep~h *
* Glc~al Yaria~)les : ~t;YC _ image, ~geycc, *
* ~;rc:_~ma~e, src: inter ima~e, s~_dis image, * ~cale_~alues, offcet values, *

2147~3 PV5~ ~R~CONIC~XI~ ES~WARP rC 12fQ4f5~5 * ~ _ values, o values, ~:rc_scx, ~;~c_scy, *
* col ormap, ai~tribu~ion Modi~ iables: rtvc im~ge, i~ageycc, ~rc i~ge, *
src_inte~_ima~e, 3rc_dis image * A~thor : Ravi~a PcaYl *
* ,t Date : J~nuary 11, 1995 *
* Modif i~:ation~ Hist~r~ : *
* Cc>pyI~ight :: Panorami¢ v$ewinq Syste~ Inc. *
***~***~*~*******~*~*****~**~*~*~******~**********~*********~****~*~*~

void get_~Lges~

f * Plush i m~ge }~uf fers *f clean_up ~ ) :
/* ~F çple ~he Y~ ge to the range O - ~55 */
xil resc~le~*vc iDlage, imageycc~, ccale Yalue~;, o~fse~_~alue~;~ 5 ~* C~r~ L to grayec~le ~
xil_color_c~nv&rt(im~;, y~, ~c_i~age);

if tsrc_depth == 8~
{
/* Re~c-~le~t~e grayscale ~age ac:-:o~ding to colormap o~f~;e~ */
if (cmap ~~ l xil_re~:cale ~ c_l~age, src inter_image, 8_ value~;, o alues~ ;
el~e xil_copy(~rc~_i~age, ~:rc_inter_image) /* ~cale ar~d di~play the i~age ~/
xil_scale ( ~tr¢_inter image, ~:~c_dis_image, "nearest", src scx, src_~y~;

~* Dith~ graywale i~age i~ w scre~en *~f else if (s3rc_~epth == 1) {

P~ge 7 2147~33 PYS\SO~ ~\Co~IC~XII,~DR~S'~WA~P. c 12J04~S
xil_scale[src_image, src ;nter im~e, ~n~arestn,~r¢~
src_scy~ .
xil_errar_d~ffusion(~;rc_inter ~mage, src d~s_i~age, colormap, distribution);

~ A~ l*~***~*********~******~**~*****~**~*********~****~
* Pun~ion : remove i~age lib~) *
D~cription : Clo~;es the XIL library. *
* Parame~ers: : None~ *
t Func~ions Qalled ~ l~one. *
R~ lue : None.
* ~
* ~ n 1 Var~ 8tate *
* Author : Kavita Ravi *
* ~ate : Jahu~ry 11, 1995 *
* ~od~fications Hi~:to~
* C~ igl~t: Panora~nic Viewing Systems I~o~ *
~*****~*****~*~*~**~*************~******~***********~*****~***~****t/

void re~c~ve imaS~e lib xil lo-~e~s1:ate~

/~*********~****'A~A~*~**~*~**t***************~ **~**********~***
* E~na~ion : w~rp ~ ) ~
* l~e~;cription: Warps the r nput image u~iing the lookup *
* t~le an~l di~pl~ys the re~ lting ou~put im~ge. *
* Parame~er~ : None ~ *
* F~D~tion~ lled : None. *
R~ Lu~ ..~d va~ ue : N~ne .
~ *
* Ext;ern V~rl5~1es : tabl~, c:map, grc depth *
* Global Variable: : ~rc image, de~ ima~e, *
Pa~e 8 , E: ~PVS~SO~WARE~CONI~:\XIL~ WARP. C 12~04/9~
* ~ de~t_in~er~ age, da~t_dis_~mag~, *
* dest width, d~st_ hei~h~, src width, * tlest_scx, d~t scy, s value;, o_v;!llues, x color~ap, diætri~u~ion *
* ~ladified Vària~le~ image, de~t inter im~ge, * de6t_dis_iDIage *
Author : Itavit~ ~4v$ *
* ~e 2 Jar~uary 11, ~ gg5 *
* ~ r'ications History: *
~opyri~ht: P~noramic Viewing Sys~s In~. *
*~*~***~***~**************~**~********~**~*l~A~ ~***~**~*~*****~
void wa~p r ) {
int i, ,j;
i nt idx un~ignod in~ ~4C, yy;
Xil_boolean sta~us, ~;tatusl;
tcirage src ~:torage, dest e:torage ~ J* XIL storage in~rmat$on *~
~ the XIL images *~
xil_e~G L(~rc $ma~e) xi}_export~dest_image) ~* Obtain t~e memory ;nforma~ion of XI~ iDage~ *~
~aLu~ = xi} get me~ory_ storagQ(src image~ &sr~_s~orage);
usl = x~l_get_~e~ory_~Lor~ dest image, &dest_~o~e~ ;
. ~ Perfor~ the warp *~
~or~i = O; i c dest heigh~; i+l) for~; = O;`j ~ des~ width; jl+~
idx - i*dest width ~ j xx - ~abletidx~.x ;
yy - table[idx].y ;
de~_stor~e.~y~e.data[idx] ~
s~c storage~ ~ te~datalyy*~rc_wi~thtxx]

}
/* Import ~he i~s~s *f xil-import~r~-image~

i E~ rS~SC~ARE\CONIC~XII.~l~RES~WA~ C 12fO4f95 X$1~ d, es~ ~age, 1) ~* ;c~le anq~ y the warped i~age *~
if (src dep~ ~ R~
i ~ t CllLap ---- o ) xil resqale Id~ t ima~e, des~ inter_i~age, s values, o value~) ;
el~e xil copy~dest image, de~;t inter~ ge~;
xil 6cal~ ~es~_ln~er_i~age, de~t di~ e, "~e~rest", dest_~scx, dest_ SC,'7);

~* If ~w s~3:reen perfo~ di~heriny */
el3e if ~src_dep~ -- 1) x~ cale (~s~ ~Dage, dest in~er_image, '~nearest", de~:t ~:~x, dest_~;cy);
x~l_error_qif~usi~n(de~t: i~tçr_im~ge, des~ dis ima~, co~ormap, di~ribution);

J***~********~*~,******~*~******~*****~****************~*~**~***~**~*~
* *
* ~-2~;on : re~:i2e_i~ge~) *
* *
Description : When a display window i5 resized, ~1: resiz~: *
* contentæ of t:he wlndc~w and redi~pl~y2;. Se~:s ** the new scale ~ctor~:~ *
Pars3neter~ int fl~g 0 - inE~ut display *
* 1 - o~ isplay *
* : int width new ~idth * int ~eight n~ heigh~ *
Fwlctions C~alled: None.
* ~e~urned value : ~one.
* *
* ~xte~n Variables : ~r~ _display, dE~st display *
* src_~nJ de~t win, ,t * src_depth * ~lcb~l Yar~ables : ~ro~ e, dest_i~age, *
* . srç ~nter imzlge, ~est_inter_image, * src_dis_image, de~:~ di~ ~a~e~ *
* . ~rc _ scx, sr~ ~, de~t scx, ~e~t_$~y, *
* oolor~aap, distri~ut~on * . . *
* Mo~i~ied Va~ia~}es: srç_in~er image, de~3t_inter_image, *
* ~ src dis_i~ge, dest dis_image, L

`_ 56 - E~ S~SOETWARE\CONIC~XIL~RES~ARP~C 12~04~9S
* sr~_scx, src_scy, de&t scx, dest s~y *
* Au~o~ : Kavita ~avi *
* Date ; January 11, lg9S *
Mfodificattons History: *
copyrlght: Panoram$c: Viewing SysteDI~ Inc. *
*****~f********~***~***~ ******~***ff~f*~******~***fff**~****~**~*~***/
void re~;i2e i~age(flag,wldt~,height~
int flag;
int widt~, heig~t int w, hh~ ifIlb; f~ Width, height and b2~nd~: of i~age *~
XilD~L~ dt; ~* XlL i~age datz~type *J
~* Check i~ linput or cm~put display window is resize~ *J
la~ -- o ) ~ ~ input di~play *J

~* D~2sL~oy ~ ;tin~f display image ~/
xil_de-tro~ tsrc_di~ Qage) src_dis_il~ge -- xil_c:reate_from wfindow~et~e~src--di~splay~ ~rc:_win);
~'* ~et t~e n-3w ~idth an~ heig~t and set new scale factors *~
~3rc ~;cx = ~:flo~t~ wi~ src widt~;
:rc_e:~ Y ~float) height~;rc_hei~ht;

~* Re~:ize ~~he image and ~iP.rl~y *~
if ~rc_dep~
if ~tlp = 0) xi~ aale~src inte~ image, ~;rc_dis ima~e, "nearest",~;ro_scx, sr~:_scy);

f ~ If b/w Gcre~n dither tho image *~
else if (e:rc_(lep~h 3 1) xil_de~;trc y(~;rc_inter_image~ s src:_int~r im~g~ = xil create ~ ~:tate, wid~h, height, 1, XIL_R~;
xil_:;cale(src image, src_inter i~Qage, nnearestn~ 12rc 8CX, src~
xil_er~or diffu~ion~src inter image, src~ _i~age, colorDlap, ~is~r~ut:i;on~;

P~3e 1 1 , 21473~3 ~;~YS\SOFTWARE\CONIC~X~L~DRES\WARP~Ç 12fO4~5 else /* a~L~ display Destroy, exi~t~n~ d~ splay image xil_destro~ ~dest di~ age~ , ~le~t~ cage -- x~l_create from windcw(state,def:t display, des~ rin~;
f* Get the,new wi~th and height an~ ~:e~ rleW ~c~ale ~o~ors *~
de~t_scx = ~float) ~id~h/des~_wi~th;
des~ scy -. ~float~ ~eigh~dest hei~ht:
Re~ize ~he i~g~` and display rc_depth~
i~ (CDap ~ O) xil s~ale ~dest_in~er image, dest_di~:_imaqe, "ne~r~t", dest_sc~, de~ y) /~ If b~w scre~n d~ther the i~age *~
else if (~rc:_ae~tll 1) xil ~estray~de~t _ in~er _ ~e~;
de~;t~ image = xil create~state, width, height, 1, XIL BYTE~ ~
xil_~ le~des~ i~age, de~t inter_image, "nearest", dest scx, dest _ scy) xil_error difiusion~de~:t inter i~a~e, dest_dis_image, colormap, .

J*t%***********~*~**~**~*~**$~***~**************~*~*~*~*~*~*****~**
* : , . *
* Funct~Dn : redr~w_image(~ ~
* *
* Descript~on : Redraw5 the Gontent~ of di~pl~y win~ow. *
* Pa~me~ers : int flag 0 - input display * 1 - output display * Fvnc~i ons ~al~ed : ~one.
* r~ rn~ v~l~e : None.
* Extexn Yari ~;bles : src depth *
* Gl~bal VAriab~es : src dis_image, des~_dis_image, *
-sr~ scx, src ~cy, dest scx, de~t_~cy, *
Pag~ 12 2147~3 E: \PVS~80PTWARE~C~ONIC~XIL~ES~W~P. c 12/04/~5 * -~rc_inter_i~age, dest inter image, *
color~ap, di~tribution *
* Modified Variables: src dis il~age, de;t_di imag~ *
Autbo~ : K~vi~a Ravi *
Date ~ Janua~ ll, ~9~5 *
*~******~**~*~**~*~*t*********~**********************~*****~**********~

vo~d redraw_i~aqe ~ f la~) int flag;
if ~flag == a~ /* input di~play ~/
J~ Red~aw t~e image */
if t~rC _ deptlh ~ ~) xil_~cale~src~ er ~z~ge, ~rc_dis_imager "nearestn,src_8CX, erc scy);:
el~ if(~s depth c l) xil_srrcr_di~f~ n~src inter image, src di~_i~age, col<~ p, distribui~ion);
else /* ~2~t~u- di~:play *~
if (~rc _ depth ~= ~1 xil ~qale~del:~' inter i~age, dest dis image, "neare~:t~,d~st ~cx~
dest ~ J
el~e ~f t~rc, depth ~
xil_error diff~sion(de~;t_inter ~age, de&t_dis_image, colorn~p, distri~ution~ J
}

Claims (20)

THE EMBODIMENTS OF THE INVENTION IN WHICH AN EXCLUSIVE
PROPERTY OR PRIVILEGE IS CLAIMED ARE DEFINED AS FOLLOWS:
1. A compound lens comprising:
a housing having first and second ends, a central axis defining an axial direction, the axial direction towards the first end defining an azimuth, and a radiation collecting aperture at the second end of the housing;
an azimuthal optical element attached to the first end of the housing and having a field of view including viewing directions at an acute angle to the azimuth, the azimuthal optical element being oriented to direct radiation through the radiation collecting aperture;
a first annular optical element attached to the housing and having a first annular field of view including viewing directions at an obtuse angle to the azimuth, the first annular optical element having a central aperture for passage of radiation from the azimuthal optical element and being oriented to direct radiation through the radiation collecting aperture; and the first annular optical element having an essentially constant resolution.
2. The compound lens of claim 1 in which the azimuthal optical element is a refracting lens and the first annular optical element is a reflecting mirror.
3. The compound lens of claim 1 in which the housing includes a first mounting block at the first end, a second mounting block at the second end, and the second mounting block includes a camera adaptor.
4. The compound lens of claim 1 in which the azimuthal optical element is an annular lens.
5. A panoramic viewing system comprising:
(A) a compound lens for viewing images, the compound lens including:
a housing having first and second ends, a central axis defining an axial direction, the axial direction towards the first end defining an azimuth, and a radiation collecting aperture at the second end of the housing; and a first annular optical element attached to the housing and having a first annular field of view including viewing directions at an obtuse angle to the azimuth, the first annular optical element being oriented to direct radiation through the radiation collecting aperture;
(B) a camera oriented to receive radiation passing through the radiation collecting aperture and convert the radiation into electrical signals corresponding to transformations of images viewed by the compound lens;
(c) an image transformer connected to receive the electrical signals and having output comprising processed electrical signals corresponding to the images viewed by the compound lens; and (D) a display device having as input the processed electrical signals and as output radiation patterns corresponding to the images viewed by the compound lens.
6. The panoramic viewing system of claim 5 further including an azimuthal optical element attached to the first end of the housing and having an azimuthal field of view including viewing directions at an acute angle to the azimuth, the azimuthal optical element being oriented to direct radiation through the radiation collecting aperture;
and the first annular optical element having a central aperture for passage of radiation from the azimuthal optical element.
7. The panoramic viewing system of claim 51 in which the display device is incorporated within a helmet to be worn by a person.
8. The panoramic viewing system of claim 5 in which the display device is mounted within a vehicle having an operator's compartment with an inner periphery, the display device being mounted around the inner periphery of the vehicle.
9. The panoramic viewing system of claim 5 in which there are more than one compound lenses as claimed, each mounted to direct radiation to the camera.
10. The panoramic viewing system of claim 5 in which the compound lens is mounted on the camera.
11. The panoramic viewing system of claim 5 further including a reflecting element mounted to direct radiation from the compound lens into the camera.
12. The panoramic viewing system of claim 11 in which the reflecting element is rotatably mounted to direct radiation into more than one camera.
13. A compound lens comprising:
a housing having first and second ends, a central axis defining an axial direction, the axial direction towards the first end defining an azimuth, and a radiation collecting aperture at the second end of the housing;

a first optical element mounted on the housing and having a first field of view and being oriented to direct radiation through the radiation collecting aperture;
a second optical element mounted on the housing and having a second field of view that overlaps the first field of view and being oriented to direct radiation through the radiation collecting aperture;
a camera mounted to receive radiation from the first and second optical elements directed through the radiation collecting aperture; and means to view a stereoscopic image formed from images received from overlapping portions of the first and second fields of view.
14. The compound lens of claim 13 in which the first optical element is an azimuthal refracting optical element and the first field of view includes viewing directions at an acute angle to the azimuth.
15. The compound lens of claim 13 in which:
the second optical element is an annular reflecting optical element;
the second field of view is annular and includes viewing directions at an obtuse angle to the azimuth; and the second optical element has a central aperture for passage of radiation from the azimuthal optical element.
16. A compound lens comprising:
a housing having first and second ends, a central axis defining an axial direction, the axial direction towards the first end defining an azimuth, and a radiation collecting aperture at the second end of the housing;

an azimuthal optical element attached to the first end of the housing and having a field of view including viewing directions at an acute angle to the azimuth, the azimuthal optical element being oriented to direct radiation through the radiation collecting aperture;
a first annular optical element attached to the housing and having a first annular field of view including viewing directions at an obtuse angle to the azimuth, the first annular optical element having a central aperture for passage of radiation from the azimuthal optical element and being oriented to direct radiation through the radiation collecting aperture; and a second annular optical element disposed within the housing and having a second annular field of view including viewing directions at an obtuse angle to the azimuth, the second annular field of view being at least partly distinct from the first annular field of view, the second annular optical element having a central aperture for passage of radiation from the azimuthal optical element and being oriented to direct radiation through the radiation collecting aperture.
17. The compound lens of claim 16 in which the azimuthal optical element is a refracting lens and the first annular optical element is a reflecting mirror.
18. The compound lens of claim 16 in which the second annular optical element having an essential constant resolution across the second annular field of view.
19. A method of inspecting a pipe having an interior surface, the method comprising the steps of:
inserting a probe into the pipe, in which the probe includes a camera and a panoramic imaging device attached to the camera, the panoramic imaging device having a lateral field of view;
providing illumination for imaging the interior surface of the pipe by a lighting system carried on the probe; and moving the probe through the pipe and imaging the interior surface of the pipe.
20. The method of claim 19 in which the panoramic imaging device is a conical mirror with a central viewing aperture and a forward field of view.
CA002147333A 1995-04-13 1995-04-13 Panoramic viewing system Abandoned CA2147333A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CA002147333A CA2147333A1 (en) 1995-04-13 1995-04-13 Panoramic viewing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CA002147333A CA2147333A1 (en) 1995-04-13 1995-04-13 Panoramic viewing system

Publications (1)

Publication Number Publication Date
CA2147333A1 true CA2147333A1 (en) 1996-10-14

Family

ID=4155679

Family Applications (1)

Application Number Title Priority Date Filing Date
CA002147333A Abandoned CA2147333A1 (en) 1995-04-13 1995-04-13 Panoramic viewing system

Country Status (1)

Country Link
CA (1) CA2147333A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001037028A1 (en) * 1999-11-15 2001-05-25 Equal Reverse Thoughts Limited Method of improved image depth perception
US6734911B1 (en) 1999-09-30 2004-05-11 Koninklijke Philips Electronics N.V. Tracking camera using a lens that generates both wide-angle and narrow-angle views

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6734911B1 (en) 1999-09-30 2004-05-11 Koninklijke Philips Electronics N.V. Tracking camera using a lens that generates both wide-angle and narrow-angle views
WO2001037028A1 (en) * 1999-11-15 2001-05-25 Equal Reverse Thoughts Limited Method of improved image depth perception

Similar Documents

Publication Publication Date Title
US5586231A (en) Method and device for processing an image in order to construct from a source image a target image with charge of perspective
KR102003015B1 (en) Creating an intermediate view using an optical flow
US5317394A (en) Distributed aperture imaging and tracking system
US8269818B2 (en) Method of creating a virtual window
US5594845A (en) Method and device for processing an image in order to construct a target image from a plurality of contiguous source images
US5134661A (en) Method of capture and analysis of digitized image data
US5657073A (en) Seamless multi-camera panoramic imaging with distortion correction and selectable field of view
JP3103008B2 (en) System and method for electronic imaging and processing of a hemispherical field of view
US7274381B2 (en) Panoramic imaging and display system with canonical magnifier
US7312820B2 (en) Method and apparatus for providing virtual processing effects for wide-angle video images
US20040066449A1 (en) System and method for spherical stereoscopic photographing
US5497188A (en) Method for virtualizing an environment
US4985762A (en) Panoramic interactive system
US4513374A (en) Memory system
US20020075258A1 (en) Camera system with high resolution image inside a wide angle view
US4878183A (en) Photographic image data management system for a visual system
US5164998A (en) Apparatus and method for image pattern analysis
US20020180759A1 (en) Camera system with both a wide angle view and a high resolution view
US20060268360A1 (en) Methods of creating a virtual window
HU220409B (en) Method, apparatus and system for implanting an image into a video stream
WO2000060853A9 (en) Method and apparatus for providing virtual processing effects for wide-angle video images
CN1393096A (en) Fast digital pan tilt zoom video system
US20250022103A1 (en) Image Compositing with Adjacent Low Parallax Cameras
US5083313A (en) Video signal digitizer
CA2147333A1 (en) Panoramic viewing system

Legal Events

Date Code Title Description
FZDE Discontinued