smoothing

1.Smooth an image over a neighborhood of pixels
2.Median filtering as a special non-linear filtering and smoothing approach

Determine the average of neighboring values
1. moving average [1 1 1 1 1] x 1/5
2. weighted moving average [1 4 6 4 1] x 1/16

smoothing process over an image using averages

some observation
-small image “rubbed” over bigger image
kernel h(i,j)
3×3 area around each original pixel used (i.e., neighborhood size k=1)
window size is 2k+1, therefore our wind is 3×3
G[i,j] = 1/(2k+1)^2 ΣΣF[i+u,j+v]

Special Case: Median Filtering
F[i,j]
median and average is changed value
Apply median filter to all 3*3 regions over the whole image
Median filtering: nonlinear operation often used in image processing

reduces noise, but
preserves edges(sharp lines!)
main idea: use median of all pixel in area, instead of mean

Median Filtering for noise removal

Arithmetic Blend Modes

-Divide (brightens photos)
-Addition (too many whites)
-Subtract (too many blacks)
-Difference (subtract with scaling)
-Darken fblend(a,b)=min(a,b) for RGB
-Lighten fblend(a,b)=max(a,b) for RGB

multiply fblend(a,b)=ab
darker
Screen fblend(a,b)=1-(1-a)(1-b)
brighter

Dodge and burn
-dodge and burn change the lightness of the pictures
-dodging lightens an image, while burning darkens it
-dodge builds on screen mode
-burn build on multiply mode
-there are numerous variations of each!

Darken

Blending modes

-a real life example of point arithmetic
-variety of blending modes build on concept of point processes

a bit about the setup
the final output is a pixel blend
-> screen capture + camera

Blending Pixels
-blend two pixels from two images: fblend(a,b)
For example
-average: fblend(a,b)=(a+b)/2 : lighter color
-normal: fblend(a,b)=b

Understand image format

-order of color channels
-image compression information
-matadata about pictures
(Exchangeable image file format EXIF, etc.)

point-process computations
add/subtract images
a-blending & its applications
image histograms

i(x,y)

How to obtain discrete values?
– sample the two-dimensional (2D) space on a regular grid
– quantize each sample (round to “nearest integer”)
Result: matrix of integer values (range, e.g. 0-255)

Point-Process: Pixel/Point Arithmetic
subtract value, if it is negative, it would be Black
image 1 – image 2
binary(image 1 – image 2)

CD+AE+LD
-> whole are become over 255

alpha-blending
.34 CD + .34 AE + .34 LD
transparency(conversely, opacity)
usually represented as α
α varies from 0 to 1.0
RGB -> αRGB 0-1, 0-255

Processing

PImage img;

void setup(){
	size(345, 567);
	// The image file must be in the data  folder of the current sketch
	// to load successfully
	img = loadImage("buzz3.jpg"); // Load the image into the program
}

void draw(){
	// display the image at its actual size at point(0,0)
	image(img, 0, 0);
	// Displays the image at point(0, height/2) at half of its size
	// image(img, 0, height/2, img.width/2, img.height/2);
}

openCV
here you can download
http://opencv.org/releases.html
http://opencv.jp/

in python-openCV

import cv2
img = cv2.imread('input.png')
cv2.imwrite('output.png', img)
img = imread('input.png')
imwrite('output.png', img)

imshow(img)
imageinfo('input.png')
help images

Digital Image

Typically, the functional operation requires discrete values
-sample the two-dimensional(2D) space on a regular grid
-Quantize each sample(rounded to “nearest integer”)
Matrix of integer values(Range:0-255)

image, height map, zoomed in
Pixel count
Image Histogram, intensity bins

color, red channel, green channel, blue channel

Raster image formats store a series of colored dot “pixels”
Number of bits for each pixel represents the depth of color
– 1 bit-per-pixel: 2colors (black or white, binary)
– 4 bit-per-pixel: 16colors
– 8 bit-per-pixel: 256 different colors 2^8 = 256

24 bit per pixel usually means 8 bits per color
at the two highest levels, the pixels themselves can carry up to 16777,216 different colors

Common raster image format
-gif, jpg, ppm, tif, bmp, etc

Exercise to do on own
-openCV/Python
(opencv.org, python.prg)
-matlab/octave
(mathworks.com, www.gnu.org/software/octave)
-Processing
(processing.org)

import cv2

# Read images
img = cv2.imread("mona-lisa.png")
print "Read image from file; size: {}x{}".format(img.shape[1], img.shape[0])
cv2.imshow("Mona Lisa", img)

# and run different operations on them
img_smooth = cv2.GaussianBlur(img, (7, 7), 0) #smooth image using a Gaussian Blur
cv2.imshow("Smoothed", img_smooth)

img_gray = cv2.cvtColor(img_smooth, cv2.COLOR_BGR2GRAY)
cv2.imshow("Grayscale", img_gray)
buzz=imread('buzz3.jpg')
imshow(buzz) 

Pixel

A “picture element” that contains the light intensity at some location (i,j) in the image
i, j
I(i,j) = some numeric value

width * height
= 1280 * (1280 /2)
= 0.8192mp image

Characteristics of a digital image
Original Image, Zoomed In, Values
Piots of values at a slice

A two-dimensional array of pixels and respective intensities
image can be represented as a matrix
intensity value range from 0 = black to 255 = white
two dimension array

8 bits allow to represent 2^8 = 256 different values

Digital image is a Function
x or i, y or j

Digital image

Rays of light -> Picture
Illumination, optics, sensor, processing, display

make an image a “computable” object
A digital image

digital image – pixel and image resolution
discrete (matrix) and continuous (function) representations
grayscale and color images
digital image formats

A digital image(W X H)
column and rows
width, height
square image -> 512 x 512 pixels = 262 = 0.26mp image
mp: mega pixel image

Numeric representation in 2-D (x and y)
Referred to as I(x,y) in continuous function from I(i,j) in discrete
Image resolution expressed in terms of width and height of the image

Extend FP / DP

Compared to FP/DP, CP has better specification and support for
Dynamic range
Vary focus point-by-point
Field of view vs. resolution
Exposure time and frame rate
Bursts

Images in News
Kennedy Assassination
Rodney King Beatings in LA
9/11 images
7/7 London bombing
Virginia Tech
Michael Richards
Russian meteor
Beast with a Billion eyes(literally)

Participatory Data
Handheld, citizen, etc.
Institutional Imagery
Satellite, Airborne, Recon, UAV
etc.
Incidental
security cameras, ATMs, etc

Computer Vision and Computer Graphics
images(2D) -> geometry(3D), Photometry(Appearance)

Utimate Camera
object, light rays, lens, film(retina)

Emerging Field of computational photography
what will a camera look like in 10 years? 20 years?
what novel images can we get? what are their uses?

SLR(film)

-Smart phone camera comes into the market, several billion devices
-Number of photos taken each year

DSLR advantages
– more light
– depth of field
– shutter lag
– control field of view
– better glass
– other (flash, man, modes, …)

phone advantages
– computation
– data
– programmers

Film and digital cameras have roughly the same features and controls
– zoom and focus
– aperture and exposure
– shutter release and advance
– one shutter press = one snapshot

For FP/DP we can use, but cp allows us to change
optics, illumination, sensor, movement
exploit wavelength, speed, depth, polarization, etc.

Probes, actuators, network