140 likes | 267 Views
CS6825: Digital images. How are DIGITAL images created. Previous lecture we discussed how ANALOG images are created. Making Digital images. 1. Sampling image into pixels---- "picture element" 2. Quantize the pixel value to make discrete or finite. Sampling – the first step.
E N D
CS6825: Digital images • How are DIGITAL images created. • Previous lecture we discussed how ANALOG images are created
Making Digital images • 1. Sampling image into pixels---- "picture element" • 2. Quantize the pixel value to make discrete or finite
Sampling – the first step • Model sensor “array” for a 2D camera, as a 2D array as shown on right. • We use rectangles even though the actual shape is not exactly this. • Some researches use more complicated sesnor array models …but, 2D array works adequately for many applications
SAMPLING in more detail 1. fit a grid over the image pixel location (r,c)=(row,column) 2.Get value of pixel Pixel(r,c) =(R,G,B) R = ∫ ∫ red(x,y) dxdy (over pixel area) red(x,y) = function of red spectral energy at each contiguous point in your sensor
Resolution, Size of Image • Image size = (rows)*(colomns) • Resolution = size of image = #pixels • low resolution ---> # of pixels is small • high resolution ----> # of pixels is big • HOW DO YOU SELECT A RESOLUTION? • if grid is too large you will get jagged edges • This is called Aliasing. No Aliasing Aliasing
Cat image at 24 bits / pixel (over 16 million colors) 8 bits each field – 8 /red, 8/green, 8/blue Cat image at 4 bits / pixel (only 16 colors) QUANTIZATION • Convert continuous values to discretee.g. 1.222 -> 1.0 • Instead of infinite colors we have a finitenumber of colors. • Remember in computers we store things in bits.
How to QUANTIZE • Simple Quantization scheme: The rule to convert If Zk-1 <= pixel (r,c) <= Zk then new pixel (r,c) = Qk • Zi = decision level (i = 0 to N) • Qk = quantization level (k = 0 to M)
More Quantization • We can have more complicated quantization schemes as indicated by the figures here and the quantization boundaries in the red-green space Image with no blue values only red and green The color space above produced by Photoshop Using 16-colors only, shows partitioning of space
More Quantization • We can have more complicated quantization schemes as indicated by the figures here and the quantization boundaries in the red-green space Image with no blue values only red and green The color space above produced by Photoshop Using 16-colors only, shows partitioning of space
With Our Simple Step Function Conversion – how select Q’s & Z’s • The goal is to choose Q's & Z's to minimize error produced from quantization, E where E = Expected value{(pixel- newpixel)*(pixel-newpixel )} = mean squared error Note: error= (pixel value - new value) expected value = a type of average or mean • If we try to minimize this error this leads to the following equation Qk= (Zk+1+ Zk) / 2 • So, Steps to follow are: choose Zk calculate Q's via above equation CALLED “ UNIFORM QUANTIZATION” as it splits up the space uniformly (evenly).
So, how do we choose Z’s? • Basically, it is function of image content • You want more levels (Z values) in greyvalue or color ranges in which much of the image pixels fall.
Loss in making a Digital Image? • Loss from sampling? • Not if choose the correct number of samples. • Over-Sampling = when you have more samples than you need • Under-Sampling = not enough samples are used • Loss from quantization? • Always unless your analog image miraculously happens to only have values at the quantization levels. Ok samples Under sampled 256 levels 8 levels
How to choose the number of samples (pixels) • You need 2 times the Nyquest rate. • Nyquest rate= function of highest frequency in the image • highest frequency in image = function of fastest varying spatial patter in the image = f(how fast things change)
Conclusion • Discussed 2 steps involved in creating a digital image from an analog image: Sampling + Quantization. • Discussed schemes for both Sampling and Quantization. • Discussed how to avoid loss of information in Sampling and that you always loose information in the Quantization process.