Masaki Hayashi 2015, Autumn Visualization with 3D CG Digital 2D Image Basic
2D Image Digitization
2D coordinate in image processing
Scanning
pixel Gray scale & RGB Grey scale (Black & white) RGB (Color)
pixel H size V size Image size 320 x x 480 SDTV 1920 x 1080 HDTV 3840 x 2160 4K 4096 x 2160 4K (cinema) 7680 x 4320 8K Size (Resolution) Spatial
Image data > series of data > 2 dimensional data
pixel H size V size Depth Image depth Depth (sampling bit rate) 8 bits (256 levels) 10 bits (1024 levels) 12 bits (4096 levels) 16 bits, bits RGB || 8 bits X 3 || 256 X 256 X 256 = million colors Depth and Color
Aspect ratio : 1 4 : 3 (TV in the past) 16 : 9 (HDTV, 4K, 8K) Square pixel, basically : 2 (Film)
Features of image (summary) Resolution Depth Sharpness, spatial detail Dynamic range
Image compression
JPEG Most popular Mosquito noise, Blocky noise Not suitable for Logo, text, cartoon… GIF Popular in the past. Motion-GIF Only 256 colors PNG Improved version of GIF, Most used on the Internet Un-limited color. OK for both natural image and logo stuff Loss-less compression (no quality selection) Image format
How JPEG compress image Split into 8×8 blocks Discrete Cosine Transform (DCT) JPEG data series Quantization & Entropy coding Image Approx. 1/10 compress 8×8 blocky noise Mosquito noise at sharp edge Important Less important 8×8 spatial 8×8 frequency INPUT OUTPUT
How GIF compress image Reduce colors LZW compress GIF data series colors Good for logo, font, cartoon Bad for photograph No blocky noise, no mosquito Taken over by PNG 256 colors INPUT OUTPUT (similar to ZIP)
How PNG compress image Deflate compress GIF data series Good for all kinds Loss less No blocky noise, no mosquito INPUT OUTPUT colors (similar to ZIP)
Compression method of ZIP, etc LZW, Deflate,... etc. INPUT compress 0 x 8, 1 x x 10 Output The more random the input data is, the less compression the output is.
Image processing
B (Brightness) H (Hue) S (Saturation) G (Green) R (Red) B (Blue) Color scheme Additive color mixing
RGB Chroma: Y = 0.3R G B Brightness: C R = R - Y C B = B - Y Color scheme Brightness + Chroma Hue + Saturation Brightness (Luminance)
Chroma Hue + Saturation H = tan -1 (C R /C B ) S = C R 2 + C B 2 CRCR CBCB S H Color scheme CRCBCRCB HSHS
White Yellow Cyan Green Magenta Red Blue Color bar
Histogram Input image Intensity distribution of an image Histogram
Correction
convolution 50x(-1) + 50x(-1) + 150x(-1) + 100x(-1) + 100x x(-1) + 120x(-1) + 120x(-1) + 120x(-1) = Filter (3x3 kernel) Input image Output image Spatial filtering
1/9 Mean filter 1/9 Smoothing
Median filter Input image Output image Sorting by numerical order Smoothing
Gaussian smoothing Text: © 2004 Robert Fisher, Simon Perkins, Ashley Walker, Erik Wolfart σ=1.0 Smoothing
Laplacian filter Second spatial derivative of an image Edge detection
Edge detection
Gaussian Smoothing Laplacian Laplacian is much noise sensitive To reduce high frequency noise in the output image in out Edge detection
Laplacian in out Edge enhancement using edge signal detected by laplacian Often referred as “Laplacian” Edge enhancement
Smoothing in out x k k : scaling constant for adjusting enhancement Text: © 2004 Robert Fisher, Simon Perkins, Ashley Walker, Erik Wolfart Unsharp filter (edge enhancement)
Spatial signal Frequency signal f f transforming re-transforming Spatial domain vs Frequency domain
DFT IDFT Original image Frequency signal Spatial domain Frequency domain Spatial domain vs Frequency domain DFT: Discrete Fourier Transform
DFT IDFT Original image Frequency signal Output image Mask = remove high frequency Filtered signal apply Spatial domain Frequency domain Digital filter
Gap If output pixel position is calculated by using input pixel position 2 times magnification Input Output Image magnification
Input pixel position should be calculated by output pixel position 2 times magnification Interpolated from the neighbored 4 pixel values Input Output Interporation
Original image 5 times zooming No interpolation (Nearest neighbor) With interpolation (Bi-linear) Image magnification
This works but not enough 1/2 shrinking Input Output Aliasing problem Image shrinking
5 times shrinking Undesired signal called "aliasing" appears Input Output Image shrinking
Aliasing noise
Mipmap Original image
fp / 2 fp / 4 Aliasing fp / 2 fp / 4 No aliasing LPF fp / 2 Sub-sampling & unti-aliasing
No unti- aliasing With unti-aliasing (Low pass filtered prior to the shrinking) Unti-aliasing