Color and Texture
Histograms
• A histogram of a gray-tone image is an array H[*] of bins, one for each gray tone.
Copyright By PowCoder代写 加微信 powcoder
• H[i] gives the count of how many pixels of an image have gray tone i.
• P[i] (the normalized histogram) gives the percentage of pixels that have gray tone i.
Gray image histogram
1 𝑖𝑓𝐹(𝑥,𝑦)=𝑖
0 𝑜𝑡h𝑒𝑟𝑤𝑖𝑠𝑒
Color histograms can represent distribution of pixel values
• Histogram is fast and easy to compute.
• Size can easily be normalized so that different
image histograms can be compared.
• Can match color histograms for database query or classification.
How to make a color histogram
• Make a single 3D histogram.
• Make 3 histograms and concatenate them
• Create a single pseudo color between 0 and 255 by using 3 bits of R, 3 bits of G and 2 bits of B
• Use normalized color space and 2D histograms.
Swain and Ballard’s Histogram Matching for Color Object Recognition
(IJCV Vol 7, No. 1, 1991)
Intersection of image histogram and model histogram:
numbins intersection(h(I),h(M)) = min{h(I)[j],h(M)[j]}
Match score is the normalized intersection: numbins
match(h(I),h(M)) = intersection(h(I),h(M)) / h(M)[j] j=1
(from Swain and Ballard)
cereal box image
3D color histogram
Four views of Snoopy Histograms
Multi-scale spatial color representation
• Divide an image into 𝑁 × 𝑁 grids at multiple scales
• Compute color histogram for each grid
• Concatenate all the histograms across scales and grids as a feature vector
• Color is well defined. • But what is texture?
Natural Textures from VisTex
grass leaves
What/Where are the texels?
The Case for Statistical Texture
• Segmenting out texels is difficult or impossible in real images.
• Numeric quantities or statistics that describe a texture can be computed from the gray tones (or colors) alone.
• This approach is less intuitive, but is computationally efficient. • It can be used for both classification and segmentation.
Some Simple Statistical Texture Measures
1. Edge Density and Direction
• Use an edge detector as the first step in texture analysis.
• The number of edge pixels in a fixed-size region tells us how busy that region is.
• The directions of the edges also help characterize the texture
Two Edge-based Texture Measures
1. edgeness per unit area
where N is the size of the unit area
2. edge magnitude and direction histograms
where these are the normalized histograms of gradient magnitudes and gradient directions, respectively.
Fedgeness = |{ p | gradient_magnitude(p) threshold}| / N
Fmagdir = ( Hmagnitude, Hdirection )
Local Binary Pattern Measure
• For each pixel p, create an 8-bit number b1 b2 b3 b4 b5 b6 b7 b8, where bi = 0 if neighbor i has value less than or equal to p’s value and 1 otherwise.
• Represent the texture in the image (or a region) by the histogram of these numbers.
1 1 1 1 1 100
Local Binary Pattern (LBP)
𝑁 : neighbor pixel 𝑝
r: radius (for 3×3 cell, it is 1). binary threshold function 𝑔 𝑥 is,
0, 𝑥<0 1, 𝑥≥0
𝑁 : center pixel 𝑐
Co-occurrence Matrix Features
A co-occurrence matrix is a 2D array C in which
• Both the rows and columns represent a set of possible image values.
• Cd (i,j) indicates how many times value i co-occurs with value j in a particular spatial relationship d.
• The spatial relationship is specified by a vector d = (dr,dc).
Co-occurrence Example
co-occurrence matrix
1100 1100 0022 0022 0022 0022
gray-tone image
10 3 20 2 00 1
From Cd we can compute Nd, the normalized co-occurrence matrix, where each value is divided by the sum of all the values.
But how do you choose d?
• This is actually a critical question with all the statistical texture methods.
• Are the “texels” tiny, medium, large, all three ...? • Not really a solved problem.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com