Image Analysis Low level modules • • • • • • •
Need for Meta data Need for File format BMP File format Opening a BMP File Reading Header Info Reading BMP Data 32 bit boundary for each pixel row … ? • Palettes
Image Analysis Low level modules // Converting to Grey Scale // pixel is a struct of three char type // variables char gray; for(int y=0;y < pich; ++y) { for(int x=0; x < picw; ++x ) { gray = 0.299 * pixel[x][y].red gray += 0.587 * pixel[x][y].green gray += 0 .114 * pixel[x][y].blue pixel[x][y].blue = grey pixel[x][y].green = grey pixel[x][y].red = grey } //minimum processing is done inside the loop
Image Analysis Low level modules • Great Introduction with practical examples and coding
• http://www.codeproject.com/cs/media/csharpgraphicf
Image Analysis Low level modules • Brightness – Increase = Add a number (eg. 50) to each blue component. – Decrease = Subtract a number (eg 50) from each blue component – Make it 0 if results in < 0 – Make if 255 if results in > 255 N= +50
N= –50
Image Analysis Low level modules • Contrast
N= +30
N= –30
Image Analysis Low level modules • Gamma correction
Gamma = 0.6
Gamma = 0.3
Image Analysis Low level modules • Color Filter
Red=0
Red=0
Green=unchanged
Green=0 Blue=unchanged
Blue=0
Red=unchanged Green=0 Blue=0
Image Analysis Low level modules • Smoothing – Convolution kernel – Smoothing filter
Image Analysis Low level modules • 1 2 1
Gaussian mask 2 4 2
1 2 1
Normalization Factor = 16
Image Analysis Low level modules • Laplacian mask -1 -1 -1 -1 8 -1 -1 -1 -1 Normalization factor = 1
Image Analysis Low level modules • Digitization – Converting Analog Signals to Digital Signals – Quantization level – Spatial Resolution
Image Analysis Low level modules • Region – Connected set of pixels that are invariant with respect to some features of themselves – Ideally should be exactly same BUT practically some tolerance factor or Thershold of variability can be applied – Path take any two pixels of the same region, one should be reachable from the other without leaving the region
Image Analysis Low level modules • Edge – If difference between neighbouring pixels if greater the thershold – Thershold should be set carefully
Image Analysis High-level modules • Feature vectors • Discriminant functions If size(region_x) > Thershold Region_x is a screw driver
Else Region_x is a bolt
• How to find discriminant functions – Plot a graph between number of region (yaxis) and size of region (x – axis)
Image Analysis High-level modules • Model Based – Object(Color, texture, relative location) • • • • •
Grass (Green, smooth, below) Tree (Gree, irregular, between) Sky (light blue, irregular/regular, above) Water (blue, irregular/regular, above) Mountains (brown, irregular, between)
• Fuzzy – FOR GRASS » color = green(0.8), red(0.1), blue(0.1) » Texture = smooth (0.8) irregular (0.2) » Below (0.9), between(0.1), above(0.0_