Image Processing Toolbox
Image Processing Toolbox
Processing Toolbox
Basic Introduction
Introduction
Programming
Can type on command line, or use a program file (“m”-file)
Semicolon at end of line is optional (suppresses printing)
Control flow (if, for, while, switch,etc) similar to C
Differences from C: no variable declarations, no pointers
Why MATLAB?
Shorter code, faster computation
Focus on ideas, not implementation
C:
#include <math.h>
double x, f[500];
for( x=1.; x < 1000; x=x+2)
f[(x-1)/2]=2*sin(pow(x,3.))/3+4.56;
MATLAB:
f=2*sin((1:2:1000).^3)/3+4.56;
-3-
What is the Image Processing Toolbox?
img
Thus, img(4,3) refers
to the pixel at the 4th
row and 3rd column.
Image Matrix
For some function you may need to convert image to double format
Double format has pixel values in the range [0,1]
To convert any image format to double, use MATLAB function “im2double()”
e.g.: A = imread(‘filename.extension’);
A_double = im2double(A);