2.D. Expanding image contrast
2.D.1. Linear expansion for grey scale and color images
The image histogram is a plot showing the number of pixels as a function of the pixel brightness value. It is displayed by Photoshop in a palette, and can be saved to disk (as well as displayed in both the usual form and as a cumulative or integrated plot) by IP•Measure Global–>Histogram . The examples show the histogram of the Spheres2 image from the Photoshop Histogram palette and the plug-in (the red line shows the cumulative histogram). This histogram indicates good contrast, covering the full range of brightness values (the few very bright pixels are the specular reflections from the spheres).
Examine the image histogram to determine whether it covers the full dynamic range without clipping. Many image acquisition problems are revealed in the histogram (broad peaks indicate nonuniformity or noise, clipping indicates improper lighting or poor brightness/contrast adjustment and the loss of data, comb patterns with missing values indicate ADC problems or limited bit depth for the image, etc.). Maximizing (stretching) low contrast by setting dark and bright limits using the image histogram is very fast (select Image–>Adjustments–>Levels ).
The original Au_Resn image and the result of linear stretching using the Levels adjustment
Setting the white and black points on the histogram for the Au_Resn image
For color images, the stretching must be done to the intensity information while preserving hue and saturation, not on the individual RGB channels, to avoid color shifts. This can be done by converting the image to Lab mode and processing just the L channel, but it is generally easier to use the IP•Adjust –> Contrast function which allows setting the limits manually or automatically. It is not recommended to use the built-in Image–>Adjustments–>Levels–>Auto adjustment on the individual RGB channels, since that can cause color shifts as shown in the example.
Original Fruitfly image and its histogram
Photoshop Auto Levels function IP•Adjust–>Contrast–>Auto plug-in
2.D.2. Non-linear adjustments (gamma, equalization)
Setting the black and white points (either manually or automatically) stretches the brightness values linearly. Nonlinear functions selectively expand contrast in one part of the grey scale range by contracting contrast elsewhere. This can also be used to compensate for the characteristics of the acquisition device. Simple adjustments to gamma (which has the same meaning as in traditional photographic darkroom processes) using the Image–>Adjustments–>Levels dialog, or complete control over the shape of the transfer function using the Image–>Adjustments–>Curves dialog can be used as appropriate. Also, since human vision is logarithmic, viewing the negative image ( Image–>Adjustments–>Invert ) sometimes allows details to be seen more readily. In the examples that follow, first the use of levels to adjust the image gamma is shown, with the equivalent setting in the curves dialog that produces the same result. The second set of examples shows other manipulations that are only possible with curves.
Original Bug image and the results of setting gamma > 1.0 and gamma <1.0
Inverting the image, expanding contrast arbitrarily, and reversing part of the contrast range (solarization)
The graph shown in the preceding examples is called the transfer function, relating the original brightness values to the resulting ones. If this transfer function is assigned the shape of the cumulative histogram, it produces a result called histogram equalization in which regions that have similar brightness values or subtle gradients are spread out in grey scale to enhance the visibility of the differences. The result of the equalization produces an image in which the cumulative histogram is a straight line, as shown in the example. The name “equalization” comes from the fact that equal areas of the image are assigned to each possible brightness value. The IP•Adjust–>Histogram Shaping plug-in provides the same function as the Photoshop Image–>Adjustments–>Histogram Equalization routine for grey scale images, but processes the intensity channel leaving colors unchanged for color images, and also allows selecting curves that emphasize the dark, light, extreme or central brightness values as well as linear.
Original Quarter image with its histogram, and the results of linear and central emphasis equalization
It is important to be aware that manipulation of the image contrast can be very useful to assist in visual examination of structure, and as a precursor to delineation and thresholding of features. However, any calibration based on pixel brightness (e.g., for densitometry) is destroyed in the process, so it is often advisable to keep a copy of the original image so that measurements of color or brightness can be performed.
2.E. Distorted or foreshortened images
2.E.1. Making pixels square
Particularly with video cameras and analog to digital converters used with scanning microscope instruments, adjustment is needed to make dimensions the same vertically and horizontally. Non-square pixels create a variety of problems for image processing and measurement. Acquiring images of a stage micrometer or other known calibration device that is oriented vertically and horizontally can be used but it is even simpler to image a single known structure that has the same vertical and horizontal dimensions, such as a grid, or the coin shown in the example. Using the Photoshop ruler tool to measure the height and width of the coin (469 and 485 pixels, respectively) indicates that the width of the image should be reduced to 96.7% (=469/485) of its current value to make the dimensions equal. Selecting the entire image ( Select–>All ) and choosing Edit–>Transform–>Scale allows entering this value into the width field, as shown, resulting in an image with square pixels that can be used for further work. It is generally better to compress either the vertical or horizontal axis, as needed, rather than expanding one of them.
Measuring the coin width in the Kron_vid image. Selecting the ruler and reading the length.
Entering the width into the Transform–>Scale function
2.E.2. Perspective distortion (non perpendicular viewpoint)
When surfaces are viewed at an angle, the distortion is much greater than simply non-square pixels. The same feature would appear to have a different size depending on where it lies in the image. The light microscope has a shallow depth of field and usually the viewpoint is perpendicular to the sample, but in the electron microscope it is common to have tilted specimens, which results in trapezoidal distortion. This must be corrected to permit meaningful measurements and even to facilitate proper image processing. The built-in Photoshop crop tool can correct for perspective distortion of planar surfaces as shown in the example. Use the tool to draw a rectangle around the surface to be corrected, be sure that the “perspective” box is checked in the tool bar, and position each corner of the selection to a corner of a rectangular region on the surface. The region can be proportionately enlarged by holding down the Alt/Option key while dragging one of the handles on the selection. Then click on the check mark to produce a corrected image.
Original Perspect image with superimposed crop region, and the corrected result