Sunteți pe pagina 1din 23

IMAGE PROCESSING

USING SCILAB

Rajesh B. Raut
Associate Professor, Dept. of E&C
Shri Ramdeobaba K.N. Engg. College, Nagpur
rautrb@rknec.edu

INSTALLING SIVP TOOLBOX


Toolboxes:
SIP (Scilab Image Processing), SIVP (Scilab
Image & Video Processing)
Tool we discuss: SIVP
Installation in Windows :
(XP sp3 onwards. Windows 7 is recommended)SIVP through atoms (5.3 onwards)
atomsInstall SIVP

INSTALLING SIVP
After atomsInstall SIVP, do the proxy settings
Use help proxy command to see the proxy
settings
Eg.
atomsSetConfig (useProxy, True/False)
atomsSetConfig (ProxyHost, DNS/IP Address)
atomsSetConfig (ProxyPort, Port Address)

Set the user name & password for proxy, if any.

DIGITAL IMAGE

Image is a 2D matrix

can be:
Gray

scale (M x N, M- rows and N-columns)


Color image (M x N x 3)

BASIC FUNCTIONS:
IMREAD/IMSHOW/IMWRITE

imread
output image= imread(input image)
imshow
imshow(output image)
imwrite
output=imwrite(input image, output image
name)

INFORMATION OF THE IMAGE

imfinfo- Get the information about image file


info = imfinfo(filename)

Eg: info=imfinfo(baboon.png)
returns the information: filename filesize, width,
height bitdepth, etc.

fileinfo- also provides the information about


image file

SCILAB SUPPORTING THE


DATATYPES
int8
int16
int32
uint8
uint16
double

DATATYPE CONVERSION
im2int8- Convert image to 8-bit signed integers
im2int16
im2int32
im2uint8
im2uint16
im2double

u- unsigned
double - double precision

IMAGE TYPE & ITS CONVERSION IN


SCILAB
rgb2gray
Im2bw
ind2rgb
rgb2hsv
hsv2rgb
rgb2ycbcr
ycbcr2rgb
eg.
bwlena=im2bw(lena.bmp, 0.5)

0.5 (threshold) : specify threshold in the range [0,1], regardless of the class of
the input image.

BASIC OPERATIONS
Complement
outputimage = imcomplement(inputimage)
Resize
outputimage = imresize(inputimage, multi.
factor, resizing algo)
resizing algo. can be nearest, bilinear,
bicubic or area
Crop
outputimage=imcrop(inputimage, [Xcoord Ycoord
SizeX SizeY])

RESULTS: COMPLEMENT

Original

Complement

RESULTS: CROP
lenacrop = imcrop(lena [200, 200, 200, 200]);

Original

Cropped

RESULTS: RESIZE

Original

Resized by 2

OTHER MOSTLY USED FUNCTIONS


imadd: Add two images or add a constant to an
image
imsubtract
imdivide
Imabsdif

mean2: Average or mean of matrix elements


std2: Standard deviation of 2D matrix elements

2- 2D matrix elements

OTHER IMPORTANT FUNCTION

imhist
[counts, cells] = imhist(im)
[counts, cells] = imhist(im, bins)
Counts- the returned histogram.
Cells- the intervals for bins.

Bins- The number of bins of the histogram.


If bins is not specified, default value will be used by the function
& is determined by the image type:
2 for Boolean, 2^8 for uint8 and int8, 2^16 for uint16 and
int16, 2^16 for int32, and 10 for double.

COLOR IMAGE HISTOGRAM


manifests an important global statistics of digital
images
Function available for histogram of gray images,
it can be applied directly for color images as a
combination of 3 independent gray images in
terms of R, G and B.
It can not incorporate the correlation between R,
G and B channels.
Solution: table structure (colors and their
population)

NOISE FUNCTIONS

Types

Gaussian-

additive noise
Salt & Pepper- black/white noise
Speckle- multiplicative noise
Localvar- Pixel-specific variance (Zero-mean Gaussian)

Function: imnoise
Outputimage=imnoise(inputimage, noisetype)
e.g. lenaNoised=imnoise(lena,gaussian)

IMAGES WITH VARIOUS TYPES OF


NOISE

Original

Salt & pepper

Gaussian

Speckle

IMAGE FILTERING USING


FSPECIAL

High Pass filter- used for


sobel

prewitt

laplacian

F = fspecial(sobel);

Low Pass filter- used for blurring


gaussian
Log

average

HIGH PASS FILTERING &


THRESHOLDING- EDGE DETECTION

Kernel used Sobel

Prewitt
Log

canny

TOPICS TO BE EXPLORED
FFT
Wavelets
Radon Transform
Hough Transform

TO CONCLUDE.

Scilab/SIVP is a very powerful numerical


computational tool, it also has number of readyto-use functions for processing an image/2D
matrix elements and hence Image Processing
operation can be performed with equal ease on
Scilab.

for any help on IP using SIVP, pl. feel free to contact:

rautrajeshb@gmail.com

S-ar putea să vă placă și