Graphics Graphics Korea University cgvr.korea.ac.kr Image Processing 고려대학교 컴퓨터 그래픽스 연구실
CGVR Graphics Korea University cgvr.korea.ac.kr Image Processing Quantization Uniform quantization Random dither Ordered dither Floyd-Steinberg dither Pixel operations Add random noise Add luminance Add contrast Add saturation Filtering Blur Detect edge Warping Scale Rotate Warps Combining Morphs Composite
CGVR Graphics Korea University cgvr.korea.ac.kr Image Processing Quantization Uniform quantization Random dither Ordered dither Floyd-Steinberg dither Pixel operations Add random noise Add luminance Add contrast Add saturation Filtering Blur Detect edge Warping Scale Rotate Warps Combining Morphs Composite
CGVR Graphics Korea University cgvr.korea.ac.kr Overview Image compositing Blue-screen mattes Alpha channel Porter-Duff compositing algebra Image morphing Specifying correspondences Warping Blending
CGVR Graphics Korea University cgvr.korea.ac.kr Image Compositing Separate an image into “elements” Render independently Composite together Applications Cel animation Chroma-keying Blue-screen matting Dobkin meets Elvis
CGVR Graphics Korea University cgvr.korea.ac.kr Blue-Screen Matting Composite foreground and background images Create background image Create foreground image with blue background Insert non-blue foreground pixels into background
CGVR Graphics Korea University cgvr.korea.ac.kr Alpha Channel Encodes pixel coverage information α = 0 : no coverage (or transparent) α = 1 : full coverage (or opaque) 0 < α < 1 : partial coverage (or semi-transparent) Example : α = 0.3 Partial coverageSemi-Transparent or
CGVR Graphics Korea University cgvr.korea.ac.kr Compositing with Alpha Controls the linear interpolation of foreground and background pixels when elements are composited α = 0 0< α < 1 α = 1
CGVR Graphics Korea University cgvr.korea.ac.kr Pixels with Alpha Alpha channel convention : (r, g, b, α) represents a pixel that is α covered by the color C=(r/α, g/α, b/α) Color components are premultiplied by α Can display (r, g, b) values directly Closure in composition algebra What is the meaning of the following? (0, 1, 0, 1) = (0, ½, 0, 1) = (0, ½, 0, ½) = (0, ½, 0, 0) =
CGVR Graphics Korea University cgvr.korea.ac.kr Pixels with Alpha Alpha channel convention : (r, g, b, α) represents a pixel that is α covered by the color C=(r/α, g/α, b/α) Color components are premultiplied by α Can display (r, g, b) values directly Closure in composition algebra What is the meaning of the following? (0, 1, 0, 1) = full green, full coverage (0, ½, 0, 1) = half green, full coverage (0, ½, 0, ½) = full green, half coverage (0, ½, 0, 0) = no coverage
CGVR Graphics Korea University cgvr.korea.ac.kr Semi-Transparent Objects Suppose we put A over B over background G How much of B is blocked by A? A B G
CGVR Graphics Korea University cgvr.korea.ac.kr Semi-Transparent Objects Suppose we put A over B over background G How much of B is blocked by A? How much of B is shows through A? α Aα A A B G
CGVR Graphics Korea University cgvr.korea.ac.kr Semi-Transparent Objects Suppose we put A over B over background G How much of B is blocked by A? How much of B is shows through A? How much of G shows through both A and B? α Aα A (1 – α A ) A B G
CGVR Graphics Korea University cgvr.korea.ac.kr Semi-Transparent Objects Suppose we put A over B over background G How much of B is blocked by A? How much of B is shows through A? How much of G shows through both A and B? (1 – α A ) α Aα A (1 – α A ) (1 – α B ) A B G
CGVR Graphics Korea University cgvr.korea.ac.kr Opaque Objects How do we combine 2 partially covered pixels 3 possible colors (0, A, B) 4 regions (0, A, B, AB) B A BA 0 AB
CGVR Graphics Korea University cgvr.korea.ac.kr Composition Algebra 12 reasonable combinations A in BB over AA over BBAclear A xor BB atop AA atop BB out AA out BB in A
CGVR Graphics Korea University cgvr.korea.ac.kr Example: C = A over B For colors that are not premultiplied : C = α A A + (1 – α A ) α B B α = α A + (1 – α A ) α B For colors that are premultiplied : C’ = A’ + (1 – α A ) B’ α = α A + (1 – α A ) α B A over B
CGVR Graphics Korea University cgvr.korea.ac.kr Image Composition Example Jurassic Park
CGVR Graphics Korea University cgvr.korea.ac.kr Overview Image compositing Blue-screen mattes Alpha channel Porter-Duff compositing algebra Image morphing Specifying correspondences Warping Blending
CGVR Graphics Korea University cgvr.korea.ac.kr Image Morphing Animate transition between two images
CGVR Graphics Korea University cgvr.korea.ac.kr Cross-Dissolving Blend image with “over” operator Alpha of bottom image is 1.0 Alpha of top image varies from 0.0 to 1.0
CGVR Graphics Korea University cgvr.korea.ac.kr Image Morphing Combines warping and cross-dissolving
CGVR Graphics Korea University cgvr.korea.ac.kr Image Morphing The warping step is the hard one Aim to align feature in images How specify mapping for the warp?
CGVR Graphics Korea University cgvr.korea.ac.kr Feature Based Warping Beier & Neeley use pairs of lines to specify warp Given p in destination image, where is p’ in source image? Beier & Neeley SIGGRAPH 92
CGVR Graphics Korea University cgvr.korea.ac.kr Warping with One Line Pair What happens to the “F”? Translation
CGVR Graphics Korea University cgvr.korea.ac.kr Warping with One Line Pair What happens to the “F”? Scale
CGVR Graphics Korea University cgvr.korea.ac.kr Warping with One Line Pair What happens to the “F”? Rotation
CGVR Graphics Korea University cgvr.korea.ac.kr Warping with One Line Pair What happens to the “F”? In general, similarity transformations
CGVR Graphics Korea University cgvr.korea.ac.kr Warping with Multiple Line Pairs Use weighted combination of points defined by each pair of corresponding lines
CGVR Graphics Korea University cgvr.korea.ac.kr Warping with Multiple Line Pairs Use weighted combination of points defined by each pair of corresponding lines P’ is a weighted average
CGVR Graphics Korea University cgvr.korea.ac.kr Weighting Effect of Each Line Pair To weight the contribution of each line pair : Where length[i] is the length of the i -th line dist[i] is the distance from a point P to the i -th line a, b, p are constants that control the wrap
CGVR Graphics Korea University cgvr.korea.ac.kr Warping Pseudocode WarpImage(Image, L’[…], L[…]) Begin for each destination pixel p do psum = (0, 0) wsum = 0 for each line L[i] in destination do p’[i] = p transformed by (L[i], L’[i]) psum += p’[i] * weight[i] wsum += weight[i] end p’ = psum / wsum Result(p) = Image(p’) end
CGVR Graphics Korea University cgvr.korea.ac.kr Morphing Pseudocode GenerateAnimation(Image 0, L 0 […], Image 1, L 1 […]) Begin for each intermediate frame time t do for i=1 to number of line pairs do L[i] = line t-th of the way from L 0 [i] to L 1 [i] end Warp 0 = WarpImage(Image 0, L 0, L) Warp 1 = WarpImage(Image 1, L 1, L) for each pixel p in FinalImage do Result(p) = (1-t)*Warp 0 + t*Warp 1 end
CGVR Graphics Korea University cgvr.korea.ac.kr Beier & Neeley Example Image 0 Image 1 Warp 0 Warp 1 Result
CGVR Graphics Korea University cgvr.korea.ac.kr Beier & Neeley Example Image 0 Image 1 Warp 0 Warp 1 Result
CGVR Graphics Korea University cgvr.korea.ac.kr Image Processing Quantization Uniform quantization Random dither Ordered dither Floyd-Steinberg dither Pixel operations Add random noise Add luminance Add contrast Add saturation Filtering Blur Detect edge Warping Scale Rotate Warps Combining Morphs Composite