The following is a basic overview of xv commands. Menu driven xv is fairly self explanatory in that its basic operations can be learned by exploring the buttons on the control windows. However, there are many advanced features that require manual consultation to learn (Bradley, 1992).
The xv code has been modified to:
1) Read and write IPW images. The Save menu has been changed so that IPW an option.
2) Draw lines, polygons and rectangles on an image, to output the coordinates of each line segment comprising these figures in a coordinates file.
3) Since IPW images are frequently `piped' into xv the command syntax has been modified so that it is not necessary to type `-' when the input to xv comes from stdin. (as it was in the original release of xv).
Display a color image of Tuolumne Meadows, Yosemite Park, California.
Press the right mouse button (or the ? key) to bring up the xv controls window . Click (ie. press and release) the left mouse button to select buttons on the on the xv controls window.
The buttons on the bottom half of the xv controls window and the Image Size menu change the size and orientation of the image. We recommend that you use these buttons rather than the window manager (menu in the title bar) since they retain the aspect ratio of the image.
This is a way to isolate a portion of the image. Move the mouse to an area of interest and press the left mouse button. As you move the mouse, a rectangle will be drawn. Release the mouse button to complete selection of an area. You can reselect an area just by positioning the mouse and starting again; the previous cropping frame will disappear. The Crop button in the xv controls window will be visible when you have completed a cropping frame. Click the Crop button, and the image will crop to your selected rectangle. If you wish to enlarge the cropped image, press the Dbl Size button, in the Image Size menu. Normal restores the cropped portion to its original size. The original image can be restored by pressing the Uncrop button. It may not be a good idea to Uncrop a zoomed portion of an image without first restoring its original size.
An easier way to zoom is to press the control key, move the mouse to the center of the area you wish to zoom and press the left mouse button. This only zooms an area with predetermined size. The Normal button restores the image after you zoom.
Press the middle mouse button while the cursor is in the xv image window. This will print the x and y location of the cursor, in image coordinates (i.e. with 0,0 at the top left corner). The 3 values after the `=' are the red, green and blue values for the pixel. On unmodified greyscale images, these values are the actual value of the pixel. On a color image these values are less meaningful. Color images represented by 24 bits are converted to the 8 bits available on the display. After this procedure, the original values are not retained, and the RGB values printed are the color values the program generated. For this reason, it is more useful to experiment with the controls on the xv color editor window using a greyscale image.
Load an image using the Load command, or by quitting xv, by pressing the Quit button, and restarting it with the new image, or use the image provided for this purpose.
% xv dweeb
Click the ColEdit button in the Windows menu on the xv controls window to open the xv color editor. The top left corner of the xv color editor shows the color look up table. To change the color of a pixel, click the left mouse button in one of the boxes, or on a pixel in the image, then use the mouse to move the red, green and/or blue dial indicators to obtain the desired color. To change the color of a series of pixels, press the right mouse button on the pixels you wish to color.
The graph in the lower center portion of the xv color editor window shows input intensity verses output intensity. You can move the boxes (`handles') on this line to perform a piecewise contrast stretch. The 2nd button from the top on the right of the graph changes it from spline mode to line mode, which is generally more useful with remote sensing data. You can also add more handles to the graph, using the 3rd button from the top on the right of the graph.
As an example, one can create a binary (black/white) image by moving the left handle along the x axis, and moving the right handle directly above it. This performs a threshold classification.
The HistEq button on the lower left corner of the xv color editor window performs a histogram equalization contrast stretch of the image. This procedure is usually used to attempt to enhance the definition of features in an image. This method attempts to create a "flat" histogram, that is, it tries to assign an equal number of pixels to each output brightness value. While is not always possible due to the input distribution of the image, the results obtained from this method are usually satisfactory.
These are currently the most commonly used functions of the xv color editor in our experience. Experiment with other functions. For a more complete and detailed description of the xv color editor, consult the xv manual (Bradley, 1992).
Satisfactory black and white images can be printed on postscript laser printers and color images can be printed on most color postscript printers. Select the Save menu, and save the image as a postscript file, then print the postscript file using lpr.
In order to save the coordinates of figures drawn, a coordinates file name must be specified. This is accomplished by:
1) while xv is running, type * while the cursor is in the image display window, and the xv coords window will pop up where you can type the coords file name. Alternatively, if you type any of the drawing keys and a coordinates file does not exist, this window will also pop up.
2) Use the -cf option on the command line as follows
% xv -cf coords image
where coords is the name of a coordinates file, and image is the name of the image to display.
To write the coordinates to the standard output (ie. terminal screen or pipe), use the following command: (this would most frequently be used by shell scripts)
% xv -cf - image
A white image has been provided for you to practice drawing lines and polygons.
% xv white
Type the - key in the xv display window to enter line drawing mode. Move the mouse to a starting position (first vertex) and click the left mouse button. As the mouse is moved a line will be drawn. Click the middle mouse button at some desired position to end the line.
Continue selecting vertices with the left button while drawing. Press the middle mouse button to end the line. For a free-hand curve or arbitrary line, hold the left mouse button down while moving the mouse.
Press the ^key (shift 6) while the cursor is in the xv display window to enter the polygon drawing mode, and follow the directions for drawing a multi-segmented line. When the middle button is pressed to end the polygon, a line will be drawn to the first vertex completing the polygon.
Type [ in the xv display window to enter the rectangle drawing mode, move the cursor to the upper left corner of the region you want to enclose with the retangle and click the left mouse button. As the mouse is moved, a rectangle will be drawn. Click the middle mouse key to end the rectangle.
If you want the interior of a polygon or rectangle to be filled, (for example, to make a mask), xv can be run in fill mode. The ~ key toggles on fill mode. After you draw the figure, move the cursor inside the figure and press the left mouse button. The figure will not be filled in xv, but a line will be written in the coordinates file directing the program scribe or fill to fill the area. When xv is in fill mode, it will not let the cursor leave the xv window until the left mouse button is pressed inside the object. Since this key is a toggle, fill mode can also be turned off by pressing the ~ key again. This mode can also be initialized on the command line by using the -fill option.
Press the # key in the xv display window before drawing the object. A window will pop up requesting a label. The label may be text, or it may be the desired pixel DN value for the object (outline, or filled) to be used by scribe. Unlike the fill mode described above, this key is not a toggle. If you want to label each object, you may start up xv in label mode by using the -label option.
The coordinates file representation of a line consists of an optional line beginning with a "#" sign containing a numeric or text label for the line, a line containing only the letter L, denoting a line, followed by a series of lines containing the x and y coordinates of the vertices, one pair per file line.
The coordinates file representation of a polygon is similar to the representation of a line, with the exceptions that the first line contains a letter P, and the first and last pair of coordinates will be identical. An optional line beginning with f followed by a pair of vertices denoting a `seed' for filling a polygon may be present. The seed is a pixel that is in the interior of the object.
The coordinates file representation of a rectangle contains a line beginning with the letter R, followed by the x and y coordinates of two diagonally opposite corners. The optional label and seed may also be present as described for polygons.
The coordinates file may be edited using a text editor such as vi, to add or delete labels, vertices or fill seeds. Coords files may be merged using the Unix command cat, (for files with labels) or the IPW command merge, which will sequentially label the figures.
% cat coords1 coords2 coords3 > coords
% merge coords1 coords2 coords3 > coords
If the xv image window is cropped, closed or covered by another window, when it is redrawn, the figures no longer appear on the image. However, these figures are saved in the coordinates file. If this occurs, and you wish to see the figures you have drawn, use scribe to draw them into the image. For example:
% xv -cf coords1 image
% scribe -i image -c coords1 > image1
% xv -cf coords2 image1