The measurement menu
This menu contains options for calibrating and measuring the image or details within it. Several of the options involve defining shapes. The shapes are drawn as an overlay on the image using blue lines and red crosses to mark points. Selecting one of the measurement options sets GRIP into a drawing mode so that more measurements of the same type can be made without having to select the menu option again.
Defining a shape generally results in a message window appearing. It contains numerical measurements and, for certain tyes of shape, graphs. The measurements can be saved in Comma-Separated Value (CSV) and eXtensible Mark-up Language (XML) files for further processing.
NB: Coordinates of pixels in an image are always measured from the top left corner of the image. The x axis goes from left to right and the y axis goes from top to bottom. So this is upside-down compared to conventional geometry. This is a widespread convention in computer imaging, and Sun's Java library follows the convention. It derives from the fact that traditional CRT lines are scanned from the top downwards. We could of course convert the y coordinates but rather than risk occasionally forgetting to do that, it is safer if everyone gets used to the convention.
Measurements include metadata from the camera, when they are available, such as when the picture was taken and the length of exposure. This enables measurements on a series of images to be graphed against time.
Java programmers: see the GRIP class GlassPane for the overlay and ImPane which handles the mouse events during drawing. Also relevant are the class PointList for shape definitions and the enum DrawingMode.
- configuration menu for changing the size of the square around the mouse cursor which will be magnified.
is for quick interactive measurements which are not stored. As the mouse is moved across the image the coordinates and sampled channel values are shown as numbers next to the cursor. NB: Clicking the mouse while hovering causes a new image frame to open which contains a highly magnified view around the point where the mouse was released. This is so highly magnified that the individual pixels may be seen clearly. There is an option in the
- measures the coordinates and brightness of a single point in the image. Pressing the mouse button displays a red cross at the cursor position. The cross can be dragged around to position it accurately. Releasing the mouse produces a message box showing the coordinates of the point (from the top left corner of the image) and the levels in each of the channels of the pixel under the cross. Zoom the image to 100% for positioning accurately on a single pixel.
- uses two points. Each is positioned by dragging the mouse and fixed when the mouse button is released. While the second point is being dragged, an elastic line can be seen in blue. When the second point is released a display of measurements of the straight line joining the points is shown. The measurements include the length and orientation (angle anti-clockwise from Ox) of the line and a graph of the profile of the image along the line. The profile is also redrawn at the top, replicated vertically so that the levels can be seen more clearly.
- produces a very similar measurement display as for a straight line. The difference is in the way the line is drawn with the mouse. This time it is done by holding the mouse button down and dragging to draw a freehand curve. It is easier to do this accurately using a graphical stylus rather than a mouse. It is also easier to be accurate if you zoom the image to 100% before drawing.
NB: There is a way of detecting and measuring areas automatically rather than drawing them but it is only practical in certain kinds of image. For more details see blob detection
is very similar to the curve as far as drawing is concerned. This time releasing the mouse causes the end point of the curve to be joined to the starting point by a straight line. So we now have a closed area. Measurements are made over the whole area rather than just the boundary. A red cross is shown at the centroid of the area (calculated purely geometrically, not weighted by pixel values). Measurements include a histogram of the levels in each channel over the whole area, and statistics from the histogram (minimum, mean, mode, maximum and standard deviation for each channel). The histograms provide ways of measuring colour and comparing it between images.
- is like the straight line as far as setting is concerned because a rectangle is defined by setting the points at opposite corners of a diagonal. However the measurements are like those of the freehand area - we measure the whole area of the rectangle, not just the boundary.
- requires no drawing. It produces the area measurements for the rectangle covering the entire image.
- enables the measurement to be done on exactly the same shape and at the same position as in a previously measured image. A dialogue appears, the exact form of which depends on how many other images have so far been measured. If more than one has been measured you will be offered a drop-down list from which to select.
- allows the current measuring shape to be dragged with the mouse. On releasing the mouse, the image is re-measured over the shape.
- redisplays the last measurements of this image (if any have been made).
- own menus. opens a new window containing a table of the most recent measurements on each of the currently open images, to allow them to be compared. This measurement table has its
sets a scale factor and the name of some units for making subsequent spatial measurements on the current image. This is possible if there are two points in the image which are a known distance apart. First set two points to define a straight line between the points of known separation. A dialogue then appears, for entering the name of the units and the separation of the two points in those units. For this to be useful it is best to include a ruler of some kind in the scene when it is photographed. The scale should be at the same distance from the camera as the objects you wish to measure. A suitable ruler can be obtained by printing this image:
Well, not the image as shown here but the SVG (Scalable Vector Graphics) image to which it is linked (click on the image above). SVG images can be displayed by FireFox browser version 1.5 or later. Internet Explorer can display it with the aid of the SVG plug-in from Adobe. But the best way to print the SVG image is to save it as an SVG file (Save target as...) and open it in an SVG-aware vector graphics application such as Adobe Illustrator, then print it from there.
NB: GRIP assumes that the camera has square pixels, so the calibration factor will be the same at any angle. The calibration is a property of the image window, not of GRIP as a whole.
displays the current calibrated units and the scale factor between pixel spacings and those units:
- is for copying calibration from one image to another. That is suitable if both images have been taken at the same distance from the camera with the same focal length setting. If there are several other calibrated images GRIP will offer a list of images for you to select from.
- removes any blue lines and red crosses remaining from making measurements.
- image menu. draws into the image any blue lines and red crosses from making measurements and clears the overlay. This alters the displayed image of course but not the image file on disc. Save the image as a new file if you wish, from the
The 2D profile option on the measurement menu of that small window produced this (opens in new window).
draws a contoured isometric view of the brightness profile of each of the channels in the image. It is NOT designed for use on full-size images, which will cause an error (GRIP does not yet protect itself from this case, but the error is not fatal and nothing will be lost). Rather, it is meant for use on a small sample that has been obtained by using the Hover and magnify option described above. Eg, we pointed to a star in Hover andmagnify mode and got this window:
- opens a new window to display a 3-dimensional graph of the histogram of the image as an orthogonal projection: 3 graphs are red against green, green against blue, blue against red. Moving the mouse over pixels in the original image will cause 3 cursors to move over the histogram, showing where the "moused pixel" lies in the plot. The usefulness of this is unclear but it was an interesting challenge to program!
- is experimental, for warping one image to map onto another. More details will be given when the process is more robust.
- here. displays the present page if you have installed files as described