Image Properties and Simple Point Operations CS/BIOEN 4640: Image Processing Basics January 17, 2012 Image Brightness Definition The brightness of a grayscale image is the average over all pixel intensities. So, the equation for brightness of an image I is h w 1 XX B(I) = I(u, v) wh v=1 u=1 Dynamic Range Definition The dynamic range of an image is the total number of distinctive pixel values that occur in the image. I Dynamic range is limited by the number of bits per pixel used to represent the image. I Also limited by the dynamic range of the sensor. I Image processing cannot add dynamic range (without making it up). Example: Dynamic Range Very Low Dynamic Range (6 values) Low Dynamic Range (64 values) High Dynamic Range High Dynamic Range Imaging I If both dark and bright areas in a scene, a camera cannot capture details in them both with a single exposure. I Details in dark areas are captured by long exposures, while details in bright areas are captured by short exposures. I To overcome limited dynamic range, we can take multiple exposures and use image processing to combine them. Image Contrast Definition The contrast of a grayscale image is the amount to which different objects in the image can be visually distinguished from one another. I Contrast is how well an image utilizes the range of pixel intensities available. I It is independent of the brightness in an image. Example: Image Contrast Low Contrast Original Contrast High Contrast Equation for Contrast? Unlike brightness, contrast is harder to nail down mathematically. Many definitions are of the form: Contrast = Change in Luminance Average Luminance For example, Michelson’s Contrast: CM (I) = max(I) − min(I) max(I) + min(I) Equation for Contrast? I These types of equations make sense for images with roughly two luminances, i.e., uniform foreground and background. I They do not work well with more complex scenes, or scenes where max and min pixels occur in small quantities. Point Operations Definition A point operation on an image is an algorithm that changes each pixel value according to some function: I(u, v) 7→ f (I(u, v)). I The function f depends only on the pixel value. I It is independent of the spatial location (u, v). I The domain of f must match the range of I , and the range of f determines the output image type. Point Operation Pseudocode Input: an image I(u, v) defined on [1 . . . w] × [1 . . . h] Output: new image I 0 (u, v) for v = 1 . . . h for u = 1 . . . w set I 0 (u, v) = f (I(u, v)) Example Point Operation Functions I Addition (changes brightness) f (p) = p + k I Multiplication (stretches/shrinks image range) f (p) = k × p I Real-valued functions: exp(x), log(x), (1/x), xk , etc. Clamping The following function will clamp pixel values to fall within the interval [a, b]. a if p < a f (p) = p if a ≤ p ≤ b b if p > b Intensity Windowing Definition Intensity windowing is a clamp operation followed by linearly stretching the image intensities to fill the full possible range. If we want to window an image in [a, b], with max intensity M : 0 f (p) = M × M p−a b−a if p < a if a ≤ p ≤ b if p > b Example: Intensity Windowing Original Image Windowed Image Thresholding Thresholding converts a grayscale image into a binary image by making every pixel below some threshold equal to 0 and every pixel above that threshold equal to 1. ( 0 if p ≤ a f (p) = 1 if p > a Example: Thresholding Original Image Thresholded Image