Histograms and Color Balancing

Slides:



Advertisements
Similar presentations
Filtration based on Color distance
Advertisements

Grey Level Enhancement Contrast stretching Linear mapping Non-linear mapping Efficient implementation of mapping algorithms Design of classes to support.
Digital Image Fundamentals Selim Aksoy Department of Computer Engineering Bilkent University
Computational Photography: Color perception, light spectra, contrast Connelly Barnes.
Digital Image Fundamentals Selim Aksoy Department of Computer Engineering Bilkent University
HISTOGRAM TRANSFORMATION IN IMAGE PROCESSING AND ITS APPLICATIONS Attila Kuba University of Szeged.
Image (and Video) Coding and Processing Lecture 5: Point Operations Wade Trappe.
Image Processing IB Paper 8 – Part A Ognjen Arandjelović Ognjen Arandjelović
Color spaces CIE - RGB space. HSV - space. CIE - XYZ space.
Computer graphics & visualization HDRI. computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization.
Color Image Processing
Light Light is fundamental for color vision Unless there is a source of light, there is nothing to see! What do we see? We do not see objects, but the.
Computational Photography Prof. Feng Liu Spring /15/2015.
EE 7730 Image Segmentation.
CS443: Digital Imaging and Multimedia Point Operations on Digital Images Spring 2008 Ahmed Elgammal Dept. of Computer Science Rutgers University Spring.
Digital Cameras CCD (Monochrome) RGB Color Filter Array.
Color: Readings: Ch 6: color spaces color histograms color segmentation.
Image Enhancement.
A Novel 2D To 3D Image Technique Based On Object- Oriented Conversion.
What is wrong with this picture? Recap from Lecture 2 Pinhole camera model Perspective projections Focal length and field of view Remember to use your.
Image Processing David Kauchak cs458 Fall 2012 Empirical Evaluation of Dissimilarity Measures for Color and Texture Jan Puzicha, Joachim M. Buhmann, Yossi.
9/14/04© University of Wisconsin, CS559 Spring 2004 Last Time Intensity perception – the importance of ratios Dynamic Range – what it means and some of.
Lecture 1: Images and image filtering CS4670/5670: Intro to Computer Vision Kavita Bala Hybrid Images, Oliva et al.,
Chapter2 Image Formation Reading: Szeliski, Chapter 2.
CS 376b Introduction to Computer Vision 02 / 26 / 2008 Instructor: Michael Eckmann.
Tomihisa (Tom) Welsh Michael Ashikhmin Klaus Mueller Tomihisa (Tom) Welsh Michael Ashikhmin Klaus Mueller Center for Visual Computing Stony Brook University.
1 Color Processing Introduction Color models Color image processing.
1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng.
Computer Science 631 Lecture 7: Colorspace, local operations
Manipulating contrast/point operations. Examples of point operations: Threshold (demo) Threshold (demo) Invert (demo) Invert (demo) Out[x,y] = max – In[x,y]
1 Chapter 2: Color Basics. 2 What is light?  EM wave, radiation  Visible light has a spectrum wavelength from 400 – 780 nm.  Light can be composed.
Recap from Lecture 2 Pinhole camera model Perspective projections Lenses and their flaws Focus Depth of field Focal length and field of view Chapter 2.
Image Filtering Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/02/10.
CSC361/ Digital Media Burg/Wong
Histograms and Color Balancing Computational Photography Derek Hoiem, University of Illinois 09/10/15 “Empire of Light”, Magritte.
Graphics Lecture 4: Slide 1 Interactive Computer Graphics Lecture 4: Colour.
G52IIP, School of Computer Science, University of Nottingham 1 Summary of Topic 2 Human visual system Cones Photopic or bright-light vision Highly sensitive.
Color Processing : Rendering and Image Processing Alexei Efros …with most figures shamelessly stolen from Forsyth & Ponce and Gonzalez & Woods.
Pixels and Image Filtering Computer Vision Derek Hoiem, University of Illinois 02/01/11 Graphic:
Histograms and Color Balancing Computational Photography Derek Hoiem, University of Illinois 09/13/11 “Empire of Light”, Magritte.
Colors. Color Systems In computer graphics, we use RGB colors. But… –Can it represent all colors? –Is it linear? For example, (1.0, 1.0, 1.0) is white.
03/03/03© 2003 University of Wisconsin Last Time Subsurface scattering models Sky models.
Capturing Light… in man and machine CS194: Image Manipulation & Computational Photography Alexei Efros, UC Berkeley, Fall 2015.
CSE 185 Introduction to Computer Vision
Color Models Light property Color models.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Capturing Light… in man and machine
Color Image Processing
Color Image Processing
Color Image Processing
Capturing Light… in man and machine
Color Image Processing
Pixels and Image Filtering
Colour Theory Fundamentals
Color: Readings: Ch 6: color spaces color histograms
Video System TTFs Part (I): Basic Design Strategy.
- photometric aspects of image formation gray level images
Image filtering Hybrid Images, Oliva et al.,
Color: Readings: Ch 6: color spaces color histograms
Computer Vision Lecture 16: Texture II
Color Image Processing
Capturing Light… in man and machine
Histogram Probability distribution of the different grays in an image.
Color Image Processing
Image Perception and Color Space
Digital Image Processing
Grey Level Enhancement
Review and Importance CS 111.
Computational Photography Derek Hoiem, University of Illinois
Presentation transcript:

Histograms and Color Balancing 09/13/19 “Empire of Light”, Magritte Computational Photography Derek Hoiem, University of Illinois

Administrative stuff Project 1: due Tues Part I: Hybrid Image Part II: Enhance Contrast/Color Use this poll to find teammates for CS 497 (if applicable) https://piazza.com/class/jzj8te0di3bjt?cid=36#

Review of last class Possible factors: albedo, shadows, texture, specularities, curvature, lighting direction

Histograms and Color Balancing “Empire of Light”, Magritte Computational Photography Derek Hoiem, University of Illinois

Today’s class How can we represent color? How do we adjust the intensity of an image to improve contrast, aesthetics?

Human eye cone responsivity

Color spaces: RGB Default color space Some drawbacks 0,1,0 0,0,1 1,0,0 R (G=0,B=0) G (R=0,B=0) B (R=0,G=0) Some drawbacks Strongly correlated channels Non-perceptual Image from: http://en.wikipedia.org/wiki/File:RGB_color_solid_cube.png

Trichromacy and CIE-XYZ Perceptual equivalents with RGB Perceptual equivalents with CIE-XYZ

Color Space: CIE-XYZ RGB portion is in triangle

Perceptual uniformity

Color spaces: CIE L*a*b* “Perceptually uniform” color space L (a=0,b=0) a (L=65,b=0) b (L=65,a=0) Luminance = brightness Chrominance = color

If you had to choose, would you rather go without luminance or chrominance?

If you had to choose, would you rather go without luminance or chrominance?

Most information in intensity Only color shown – constant intensity

Most information in intensity Only intensity shown – constant color

Most information in intensity Original image Image from Phillip Greenspun, used with permission

Color spaces: HSV Intuitive color space H S V (S=1,V=1) (H=1,V=1)

Color spaces: YCbCr Fast to compute, good for compression, used by TV (Y=0.5,Cr=0.5) Cb Y=1 Cr (Y=0.5,Cb=05)

Color balancing

Contrast enhancement http://en.wikipedia.org/wiki/Histogram_equalization

Important ideas Typical images are gray on average; this can be used to detect distortions Larger differences are more visible, so using the full intensity range improves visibility It’s often easier to work in a non-RGB color space

Color balancing via linear adjustment Simple idea: multiply R, G, and B values by separate constants 𝑟 𝑔 𝑏 = 𝛼𝑟 0 0 0 𝛼𝑔 0 0 0 𝛼𝑏 𝑟 𝑔 𝑏 How to choose the constants? “Gray world” assumption: average value should be gray White balancing: choose a reference as the white or gray color Better to balance in camera’s RGB (linear) than display RGB (non-linear) Demo

Tone Mapping Typical problem: compress values from a high range to a smaller range E.g., camera captures 12-bit linear intensity and needs to compress to 8 bits

Example: Linear display of HDR Scaled for brightest pixels Scaled for darkest pixels

Global operator (Reinhart et al.) Simple solution: map to a non-linear range of values

Reinhart Operator Darkest 0.1% scaled to display

Point Processing: apply a function to each pixel intensity to map it to a new value

Gamma adjustment 𝑖𝑜𝑢𝑡=𝑖𝑖𝑛𝛾 𝛾 = 0.5 𝛾 = 1 𝛾 = 2 Intensity Out Intensity In 𝛾 = 2

Matlab example

Histogram equalization Basic idea: reassign values so that the number of pixels with each value is more evenly distributed Histogram: a count of how many pixels have each value ℎ𝑖= 𝑗∈𝑝𝑖𝑥𝑒𝑙𝑠 𝟏( 𝑝 𝑗 ==𝑖) Cumulative histogram: count of number of pixels less than or equal to each value 𝑐𝑖= 𝑐 𝑖−1 + ℎ 𝑖 Do simple example of histogram on board: 3 1 2 1 2 3 4 1 5 4 3 2 1 = [(1, 4), …]

Histogram is count of elements that have a particular value or range of values A = [1 1 2 3 3 3 5 6] H = hist(A, 1:6) H = [2 1 3 0 1 1] C = cumsum(H) C = [2 3 6 6 7 8] B = [5 6 6 6 8 8 9] H = hist(B, 5:9) H = ? C = ?

Image Histograms Cumulative Histograms

Histogram Equalization

Algorithm for global histogram equalization Goal: Given image with pixel values 0≤𝑝𝑗≤255, 𝑗=0..𝑁 specify function f(𝑖) that remaps pixel values, so that the new values are more broadly distributed Compute cumulative histogram: 𝑐 𝑖 , 𝑖=0..255 ℎ(𝑖)= 𝑗∈𝑝𝑖𝑥𝑒𝑙𝑠 𝟏( 𝑝 𝑗 ==𝑖), 𝑐(𝑖)=𝑐(𝑖−1)+ℎ(𝑖) 2. f 𝑖 =𝛼⋅ 𝑐 𝑖 𝑁 ⋅255+ 1−𝛼 ⋅𝑖 Blends between original image and image with equalized histogram Show this on board for an image with alpha = 0:0.05:1. Cumulative histogram maps pixel intensity to its percentile

Locally weighted histograms Compute cumulative histograms in non-overlapping MxM grid For each pixel, interpolate between the histograms from the four nearest grid cells adapthisteq in Matlab Figure from Szeliski book (Fig. 3.9) Pixel (black) is mapped based on interpolated value from its cell and nearest horizontal, vertical, diagonal neighbors

Application of adaptive histogram equalization to color image rgb2hsv Locally Adaptive Histogram Equalization of “v” channel hsv2rgb

Before After

Other issues Dealing with color images Manipulating particular regions Often better to split into luminance and chrominance to avoid unwanted color shift Manipulating particular regions Can use mask to select particular areas for manipulation Useful Python functions/modules skimage.color: color conversion, e.g. rgb2hsv numpy: histogram, cumsum

Matlab Example 2

Things to remember Familiarize yourself with the basic color spaces: RGB, HSV, Lab Simple auto contrast/color adjustments: gray world assumption, histogram equalization When improving contrast in a color image, often best to operate on luminance channel

Next class: texture synthesis and transfer