Effect of σ on Gaussian noise

noise = randn(size(im)).*sigma;
Sigma = 2, 8, 32, 64

noise = randn(size(img)).* 2;
output = im + noise;

First attempt at a solution
Replace each pixel with an average of all the values in its neighborhood – a moving average;
original -> smoothed

Average assumptions
1. the true value of pixels are similar to the true value of pixels nearby.
2. the noise added to each pixel is done independently.

Generate Gaussian Noise

some_number = randn();
disp(some_number);

some_numbers = randn([1 5]);
disp(some_numbers);

some_matrix = randn([2 3]);
disp(some_matrix);

noise = randn([2 3]);
disp(noise);

noise = randn([1 100]);
[n, x] = hist(noise, [-3 -2 -1 0 1 2 3]);
disp([x; n]);
plot(x, n);

Noise in images

Noise is just another function that is combined with the original function to get a new – guess what – function

I(x,y) = I(x,y)+n(x,y)

Salt and pepper noise: random occurrences of black and white pixels
Impulse noise: random occurrences of white pixels
Gaussian noise: variations in intensity drawn from a Gaussian normal distribution

>> noise = randn(size(im)).*sigma;
>> output = im + noise;
dolphin = imread('dolphin.png');
bicycle = imread('bicycle.png');

diff = dolphin - bicycle;

abs_diff = abs(bicycle - dolphin);
imshow(abs_diff);

preserve image difference: uint8
・(a – b)+(b – a)
・Convert to floating point

pkg load image;

abs_diff2 = imabsdiff(dolphin, bicycle);
imshow(abs_diff2);

Add 2 images demo

dolphin = imread('dolphin.png');
bicycle = imread('bicycle.png');

imshow(dolphin);
disp("Dolphin image size:");
disp(size(dolphin));

imshow(bicycle);
disp("Bicycle image size:");
disp(size(bicycle));

summed = dolphin + bicycle;
imshow(summed);

average = dolphin / 2 + bicycle / 2;
imshow(average);

183/2 + 152/2 = 168
(183+152)/2 = 128

Inspect image value

% At a given location (row, col):
dis(img(50, 100));

dis(img(50, :));

plot(img(50, :));
% At slice of the image:
disp(img(101:103, 201:203));

disp(size(img));
% Cropped size:
disp(size(cropped));

color planes

img = imread('fruit.png');
imshow(img);

disp(size(img));

img_red = img(:, :, 1);
imshow(img_red);

plot(img_red(150, 0));

Quantize an image

2.5, 0.7, 3, 6
3.7, 4.5, 1.9, 3.2
-1.3, 5.2, 7.5, 2.9
Levels:0,1,2,3,4,5

Round down:1.8 -> 1
Limits: <0 -> 0, >5 -> 5

each number always rounding down.

% Load and display an image
img = imread('dolphin.png');
imshow(img);

% Image size:
disp(size(img));

% Image class or data type:
disp(class(img));

hight 320
width 500
class uint8

u -> unsigned
int -> integer
8 -> 8bits

A little bit of pedagody

Computational Models(Math!)
Algorithm
Real Images

matlab
https://jp.mathworks.com/

GNU Octave
https://www.gnu.org/software/octave/

An image can be thought of as:
– a 2-dimensional array of numbers ranging from some minimum to some maximu
– a function I of x and y: I(x, y)
– something generated by a camera

Images as functions
we think of an image as a function, f or i, from R^2 to R
f(x, y) gives the intensity or value at position (x, y)
Piratically define the image over a rectangle, with a finite range:
f:[a, b]x[c, d] -> [min, max]
f(x,y) = [r(x,y) g(x,y) b(x,y)]

f:[10, 210]*[15.155] -> [0, 10]
(r,g,b) channels or planes

In computer vision we typically operate on digital images:
sample the 2d space on a regular grid
quantize each sample

Image thus represented as a matrix of integer values.
width 320, height 258, area 82560
3 color -> 82560*3 total color values

>> im = imread(‘peppers.png’); % semicolon or many numbers
>> imgreen = im(:,:,2);
>> imshow(imgreen)
>> line([1 512],[256 256],’color’,’r’)

OCR and Face Recognition

Optical character recognition(OCR)
technology to convert scanned docs to text
if you have a scanner, it probably came with OCR
Handwritten Digit recognition

Face detection
-most digital cameras can detect faces

Object recognition(in supermarket)
– Evolution Robotics Retail developed LaneHawk, a retail loss-prevention solution that helps turn bottom-of-basket(BOB) losses and in-cart losses into profits in real time.
– The company was acquired by Datalogic 5 year later!

Special effects: motion capture
Earth viewers(3D modeling)

Smart Cars
Vision-based interaction (and games)
Nintendo Wii has camera-based IR tracking build in.

Game changer:KINECT – skeleton technique

Security and curveillance
Medical imaging: 3D imaging MRI.CT image guided surgery

Taking over

Scene Understanding
sky, mountain, water, ground

how to build system
what is computer vision
-> Goal of computer vision is to write computer programs that can interpret images.

Image (and movies) have become ubiquitous in both production and consumption.
Therefore applications to manipulate images(movies) are becoming core.
As are systems that extract information from imagery
-surveillance
-building 3d representations
-motion capture assisted