Techniques for Processing and Analysis of Digital Images from Grand Canyon and Great Smoky Mountains National Parks John V. Molenar, David S. Cismoski and Frank Schreiner; Air Resource Specialists, Inc. and William C. Malm; National Park Service ABSTRACT Air quality metrics were estimated from pixel data in high resolution digital images captured at Grand Canyon and Great Smoky Mountains National Parks. The air quality metrics included target/sky contrast and ground detail. The metrics were compared to collocated visibility monitoring instrumentation to determine if digital images can be used to estimate visual air quality in near real time from digital imagery. INTRODUCTION The National Park Service (NPS) and several other organizations currently operate World Wide Web based digital camera networks. One of the goals of these networks is to provide public outreach and education on air quality issues. The use of a Web-based interface allows high quality near real time images and associated air quality information to be presented together. This presentation is designed to demonstrate the link between the perceived air quality (“what you see”) and measured air quality parameters. Each digital camera system in the digital camera networks includes a high resolution digital camera, image acquisition computer, internet access, and supporting hardware. System site requirements include a vista with a recognizable or interesting view, available power, communications infrastructure, and serviceability. Each system acquires a high resolution (1600 x 1200 pixel, 8 bit per pixel) image at 15 minute intervals. Following acquisition, each system collects any available air quality and meteorological data associated with the image then and uploads the image and data to the Web site. The air quality and meteorological data available for association with a digital image varies greatly by network. Typical sites have air temperature, relative humidity, wind speed and direction, and precipitation available. In addition, some sites include of one or more of the following: criteria pollutants such as ozone, fine particles, and optical properties of the atmosphere (scattering by particles and gases, and total extinction). The perceived air quality presented by the digital image is closely related to the optical properties of the atmosphere. The optical properties are typically measured by integrating nephelometers (scattering by particles) and long path transmissometers (total extinction). It is often the case that optical measurements are not available due to specific site and operational requirements, as well as cost. This paper presents concepts being investigated to obtain air quality metrics directly from the digital images, relate the air quality metrics to measured optical measurements, and develop methods to present the air quality metrics as a surrogate for the measured optical data. METHODS Images for Grand Canyon and Great Smoky Mountains National Parks for the period October 2003 through May 2004 were chosen as representative of an eastern (relatively hazy) and western (relatively clean) vista. Each image set consists of images at 15 minute intervals over a wide variety of atmospheric, lighting, and ground/sky conditions. Each image is a 1600 x 1200 pixel, 8 bit per pixel JPEG with approximately 2:1 compression applied by the camera. The camera is an Olympus 700 series operated in full automatic mode to capture images over the widest possible lighting conditions. During each 15 minute interval there is limited time for image metric processing due to the time needed to capture the image, send it from the camera to the computer, obtain the associated meteorological and air quality data, and upload the information to the Web site. These constraints narrow the image metric processing time for the digital images to approximately 4 minutes out of the 15 minute window. Image analysis is affected greatly by lighting conditions. In particular, clouds significantly affect how the image is perceived by a human observer. For this reason, only images determined to be free of clouds (“clear sky images”) were used in this analysis. Image analysis includes preprocessing (such as clear sky analysis) prior to evaluation of image metrics. Following image capture, the image evaluation process includes the following steps: 1. Image Registration Registering each image to account for camera movement. The image registration process entails creating a black and white image of the registration region so that a binary comparison to a base registration image can be done. By moving the image out of the color domain into a binary image we can eliminate clouds, shading and other color variances for the registration process. A pixel by pixel bitwise comparison of the two images is done and if the images are at least 98% the same, the image is flagged as registered. The image is then shifted by one pixel location and compared again. This process continues until either a better fit is found (higher correlation of values between the two images) or the process “walks” beyond the registration boundary (typically 50 pixels). Image registration results in numerical offsets in the horizontal and vertical axes but does not change the image itself. In the case where the image cannot be registered (a weather event, or cloud obscuring the registration target), the last known good registration is used. The selection of the registration target in the image to register is critical. If the target is very close to the camera it is almost always visible but a small shift in registration will cause a large shift in element locations in the distance (parallax float). A target that is a long distance from the camera will not be visible on a consistent enough basis to have a high confidence in the registration. A good rule of thumb is to use a target that is ¾ the distance of the range of expected visibility for the site. 2. Clear Sky Identification Testing each image for cloud free (clear sky) conditions. Though it is not possible to determine whether an image is completely cloud free, the clear sky tests are designed to determine which images are least affected by clouds. To determine “clear sky images” a variety of techniques were tested, but the most robust technique was obtained by scanning 5 separate regions of the sky from top to bottom and determining if there were any significant discontinuities. The tests are relatively unaffected by the image registration since the sky zones are large and can be adjusted for any movement in the camera mount. 3. Image Metric Extraction Evaluating each image for metrics that can be related to measured visibility conditions. The image metrics evaluated in this paper are listed in Table 1. It is important to note that while these metrics have been evaluated so far, others are being investigated and may prove to be more closely related to measured visibility. The target/sky metric is the most sensitive to registration. Since some of the distant targets are only 30 x 30 pixels in area and a 3 x 3 matrix is used to determine the intensity of the green component, any error in registration could lead to comparing sky to sky or target to target. The image sets span the period October 2003 through April 2004 and from dawn until dusk. The lighting conditions of the scene vary dramatically by month and by time of day. Therefore, the image metrics are likely to be date (month) and time (hour) dependent. Table 1. Image Metrics Metric Description The target/sky contrast from digital image pixel intensities is defined as1: DNC’r Target/Sky Contrast = Itarget (green) - Isky (green) Isky (green) Where, Itarget (green) is the intensity of the green component of a 3x3 pixel area in the target Isky (green) is the intensity of the green component of a 3x3 pixel area in the sky above the target. The intensities are the green component of the RGB triplet and range from 0 to 255. The frequency content of a selected area of ground (non sky) is analyzed for frequency content. Frequency content is related to the visibility of edges and other details in the image. High frequency content occurs when greater detail and sharper edges are evident in the image, corresponding to higher contrast and better visibility. Since the cloud free sky does not contain details, only the ground is used. The ground detail is determined by computing the mean of the Fast Fourier Transform (FFT) of a pixel area: Ground Detail Ground Detail 1 x xy 0 y f (I ) x , y ( green) 0 Where x is the size of the selected area in the horizontal y is the size of the selected area in the vertical Ix,y (green) is the intensity of the green component of the pixel at coordinates x,y (0 to 255) f(Ix,y) is the Fourier transform of the pixel intensity Typical pixel areas are 512 x 512 or 1024 x 256 pixels. RESULTS The image metrics described in Table 1 were used to evaluate image sets from Grand Canyon and Great Smoky Mountains National Parks. Results of the evaluation are presented in the following sections. Grand Canyon Image Metrics Image metrics for Grand Canyon were compared to total extinction (bext) data from the rim-to-river (in-canyon) transmissometer and to particle scattering (bsp) data from the ambient nephlometer on the South Rim. Data were used only when the transmissometer and/or nephelometer data validity flags indicated no meteorological influences were present. Image 1 shows the target used for the target/sky contrast analysis and the area used for the ground detail analysis. Mount Trumbull was used as the target. It is 62 miles (99 km) from the camera site. Image 1. Target and Ground Detail Area of Grand Canyon Image Figures 1 through 3 show the relationship between target/sky contrast and total extinction; Figures 4 through 6 show the relationship between target/sky contrast and particle scattering; Table 2 presents the regression statistics for the target/sky contrast comparisons. Table 2. Image Metric Regression Statistics for Grand Canyon National Park Transmissometer bext vs. DNC’r Slope Intercept R2 9:00 AM 79.8 23.6 0.12 12:00 PM 129.9 27.0 0.27 3:00 PM 63.9 20.9 0.23 Nephelometer bsp vs. DNC’r Slope Intercept R2 9:00 AM 187.8 15.7 0.20 12:00 PM 151.1 13.3 0.62 3:00 PM 90.4 9.9 0.55 Figure 7 shows the relationship between ground detail and total extinction; Figure 8 shows the relationship between ground detail and and particle scattering. The Grand Canyon view is toward the west. The 9:00 AM image therefore is typically very bright and does not contain much detail, regardless of the measured extinction and particle scattering. As the day progressed, more detail becomes evident. Figures 7 and 8 clearly show this phenomenon. Figure 1 Figure 2 Total Extinction vs. Target/Sky Contrast Image Metric Total Extinction vs. Target/Sky Contrast Image Metric Grand Canyon National Park Grand Canyon National Park 9:00 AM 60 50 50 Total Extinction (bext ) Mm-1 Total Extinction (bext ) Mm-1 12:00 PM 60 40 30 20 10 40 30 20 10 0 -0.10 -0.08 -0.06 -0.04 -0.02 0 -0.10 0.00 -0.08 -0.06 -0.02 0.00 DN Figure 3 Figure 4 Total Extinction vs. Target/Sky Contrast Image Metric Particle Scattering vs. Target/Sky Contrast Image Metric Grand Canyon National Park Grand Canyon National Park 3:00 PM 60 9:00 AM 60 50 Particle Scattering (bsp ) Mm -1 -1 50 Total Extinction (bext ) Mm -0.04 C'r C'r DN 40 30 20 40 30 20 10 10 0 0 -0.10 -0.08 -0.06 -0.04 -0.02 -10 -0.10 0.00 DNC'r -0.08 -0.02 0.00 Figure 5 Figure 6 Particle Scattering vs. Target/Sky Contrast Image Metric Particle Scattering vs. Target/Sky Contrast Image Metric Grand Canyon National Park 12:00 PM 60 -1 50 Particle Scattering (bsp ) Mm 40 30 20 10 0 -10 -0.10 3:00 PM 60 50 -1 -0.04 DNC'r Grand Canyon National Park Particle Scattering (bsp ) Mm -0.06 40 30 20 10 0 -0.08 -0.06 DNC'r -0.04 -0.02 0.00 -10 -0.10 -0.08 -0.06 -0.04 DNC'r -0.02 0.00 Figure 7 Total Extinction vs. Ground Detail Image Metric Grand Canyon National Park 60 60 3:00 PM 40 9:00 AM -1 12:00 PM Particle Scattering (bsp ) Mm Total Extinction (bext ) Mm-1 50 9:00 AM 50 Figure 8 Particle Scattering vs. Ground Detail Image Metric Grand Canyon National Park 30 20 10 12:00 PM 40 3:00 PM 30 20 10 0 0 0.005 0.006 0.007 0.008 Ground Detail 0.009 0.010 -10 0.005 0.006 0.007 0.008 0.009 0.010 Ground Detail Comparison of Measured and Image Metric Based Total Extinction (bext) for Grand Canyon Target/Sky contrast measurements can be used to estimate total extinction (bext) using the following relationship1: 1 Cr bext ln r C0 where, r is the distance to the target, Cr is the apparent target/sky contrast (DNC’r in this case), C0 is the inherent contrast when r = 0. Historically, the inherent contrast used for Mount Trumbull for analysis of 35 mm Kodachrome slides has been -0.90. Analysis of slides was performed using target and sky density values calibrated to account for film processing using Kodak supplied film curves2. Calibration of digital cameras for use in estimating target/sky contrast is currently being investigated. We have found that using -0.90 for the inherent contrast yields poor results, while an inherent contrast of -0.40 yields much better results. If this correction is instead applied to Cr, the correction factor is about 0.45, which is also the Gamma correction applied to JPEG images for pleasing display on CRT and LCD computer monitors.4 Figures 9 through 14 show the total extinction measured with the in-canyon transmissometer versus the total extinction derived from the target/sky contrast from the digital images for inherent contrasts of -0.90 and -0.40 (or correction factor of 0.45 applied to Cr). Table 3 presents the regression statistics for the comparisons. Perpendicular regression was used to obtain regression lines and statistics because both data sets are subject to error1,3 . Figure 9 Measured vs. Image Metric Derived Total Extinction Grand Canyon National Park 9:00 AM C0 = -0.9 Figure 10 Measured vs. Image Metric Derived Total Extinction Grand Canyon National Park 9:00 AM C0 = -0.4 40 Transmissometer Measured bext (Mm ) -1 -1 Transmissometer Measured bext (Mm ) 40 35 30 25 20 15 10 35 30 25 20 15 10 10 15 20 25 30 35 40 10 15 -1 30 35 40 Image Metric Derived bext (Mm ) Figure 12 Measured vs. Image Metric Derived Total Extinction Grand Canyon National Park 12:00 PM C0 = -0.4 Figure 11 Measured vs. Image Metric Derived Total Extinction Grand Canyon National Park 12:00 PM C0 = -0.9 40 -1 -1 Transmissometer Measured bext (Mm ) 40 Transmissometer Measured bext (Mm ) 25 -1 Image Metric Derived bext (Mm ) 35 30 25 20 15 35 30 25 20 15 10 10 10 15 20 25 30 35 40 10 45 15 20 25 30 35 40 -1 -1 Image Metric Derived bext (Mm ) Image Metric Derived bext (Mm ) Figure 13 Measured vs. Image Metric Derived Total Extinction Grand Canyon National Park 3:00 PM C0 = -0.9 Figure 14 Measured vs. Image Metric Derived Total Extinction Grand Canyon National Park 3:00 PM C0 = -0.4 40 -1 -1 Transmissometer Measured bext (Mm ) 40 Transmissometer Measured bext (Mm ) 20 35 30 25 20 15 35 30 25 20 15 10 10 10 15 20 25 30 35 -1 Image Metric Derived bext (Mm ) 40 10 15 20 25 30 35 -1 Image Metric Derived bext (Mm ) 40 Table 3. Total Extinction Regression Statistics for Grand Canyon National Park Measured vs. Image Metric Derived bext 9:00 AM C0=-0.90 9:00 AM C0=-0.40 Slope Intercept R 0.89 -6.5 0.19 0.89 0.83 0.91 1.33 -18.24 0.15 1.33 -7.3 0.91 0.79 -4.4 0.09 0.79 2.1 0.76 (or Cr correction = 0.45) 12:00 PM C0=-0.90 12:00 PM C0=-0.40 (or Cr correction = 0.45) 3:00 PM C0=-0.90 3:00 PM C0=-0.40 (or Cr correction = 0.45) Great Smoky Mountains Image Metrics Image metrics for Great Smoky Mountains were compared to total scattering (bsp) data from the Look Rock ambient nephelometer (the Park does not have a transmissometer). Data were used only when the validity flags indicated no meteorological influences were present. Image 2 shows the target used for the target/sky contrast analysis and the area used for the ground detail analysis. Rich Mountain was used as the target. It is 10 miles (16 km) from the camera site. Image 2. Target and Ground Detail Area of Great Smoky Mountains Image Figures 15 through 17 show the relationship between target/sky contrast (described in Table 1) and particle scattering, and Table 4 presents the regression statistics for the plots. Figure 18 shows the relationship between ground detail (described in Table 1) and particle scattering. The Great Smoky Mountains view is toward the south and the images often include inversions and meteorology below the horizon such as clouds in the valleys. In addition, the deciduous trees can be coated with frost, causing very bright detail against dark coniferous trees. This manifests itself as high frequency information that is not related to the measured particle scattering. As with Grand Canyon, the 9:00 AM images show limited detail, regardless of the measured particle scattering Figure 15 Figure 16 Particle Scattering vs. Target/Sky Contrast Image Metric Particle Scattering vs. Target/Sky Contrast Image Metric Great Smoky Mountains National Park Great Smoky Mountains National Park 9:00 AM 80 70 60 Particle Scattering (bsp ) Mm-1 Particle Scattering (bsp ) Mm-1 12:00 PM 80 70 50 40 30 20 10 0 60 50 40 30 20 10 0 -10 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 -10 -0.5 -0.4 -0.3 C'r DN -0.2 C'r DN Figure 17 Particle Scattering vs. Target/Sky Contrast Image Metric Great Smoky Mountains National Park 3:00 PM 80 60 50 40 30 20 10 0 -10 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 C'r DN 80 Figure 18 Particle Scattering vs. Ground Detail Image Metric Great Smoky Mountains National Park 70 Particle Scattering (bsp ) Mm-1 Particle Scattering (bsp ) Mm-1 70 9:00 AM 12:00 PM 3:00 PM 60 50 40 30 20 10 0 -10 0.003 0.004 0.005 0.006 Ground Detail 0.007 0.008 -0.1 0.0 Table 4. Image Metric Regression Statistics for Great Smoky Mountains National Park Nephelometer bsp vs. DNC’r Slope Intercept R2 9:00 AM 100.4 46.5 0.65 12:00 PM 157.1 65.5 0.70 3:00 PM 171.7 65.9 0.75 SUMMARY Digital images can be used to obtain image metrics correlated to measured air quality parameters such as total extinction and particle scattering. Images and data from Grand Canyon and Great Smoky Mountains National Parks for the period October 2003 – April 2004 were used to evaluate two such metrics: Target/sky contrast and ground detail. Initial results show a clear relationship between information extracted from the images and measured visibility parameters. These first two metrics are very preliminary and are in the process of further development and refinement. Other metrics are also being evaluated. It appears that application of the target/sky contrast metric requires taking the Gamma correction inherent in JPEG images into account. The Gamma correction is part of the overall camera calibration information: how the image created by the camera relates to the actual scene. Accurate registration of the images is critical to the collection of useful metrics from the images. REFERENCES 1. Malm, W. C., G. Persha, R. Tree, R. Stocker, I. Tombach, and H. Iyer, Comparison of Atmospheric Extinction Measurements Made by a Transmissometer, Integrating Nephelometer, and Teleradiometer with Natural and Artificial Black Target, in Proceedings of APCA International Specialty Conference – Research and Policy Aspects, Grand Teton National Park, WY, September 7-10, 1986 2. Dietrich, D. L., M. A. Klitch, D. S. Cismoski, and J. V. Molenar, An Assessment of the Accuracy and Precision of Photographic Densitometric Measurements for Monitoring Visual Air Quality, in Transactions: Visibility and Fine Particles, pp. 281-292, C. V. Mathai, Editor, Air and Waste Management Association, Pittsburgh, PA., 1989 3. Mandel, J., Fitting Straight Lines When Both Variables are Subject to Error, in Journal of Quality Technology, Volume 16, Number 1, January 1984 4. Poynton, C., Digital Video and HDTV, Algorithms and Interfaces, Morgan Kaufmann Publishers, San Francisco, CA., 2003, Library of Congress Control Number 2002115312, ISBN: 1-55860-792-7