IMAGE PROCESSING USING SCILAB Rajesh B Raut Associate
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 sp 3 onwards. Windows 7 is recommended)- SIVP through atoms (5. 3 onwards) atoms. Install SIVP
INSTALLING SIVP…… After atoms. Install SIVP, do the proxy settings Use help proxy command to see the proxy settings Eg. atoms. Set. Config (use. Proxy, “True/False”) atoms. Set. Config (Proxy. Host, “DNS/IP Address”) atoms. Set. Config (Proxy. Port, “Port Address”) Set the user name & password for proxy, if any.
DIGITAL IMAGE Image is a 2 D 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(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 int 8 int 16 int 32 uint 8 uint 16 double
DATATYPE CONVERSION im 2 int 8 - Convert image to 8 -bit signed integers im 2 int 16 im 2 int 32 im 2 uint 8 im 2 uint 16 im 2 double u- unsigned double - double precision
IMAGE TYPE & ITS CONVERSION IN SCILAB rgb 2 gray Im 2 bw ind 2 rgb 2 hsv 2 rgb 2 ycbcr 2 rgb eg. bwlena=im 2 bw(‘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 Size. X Size. Y])
RESULTS: COMPLEMENT Original Complement
RESULTS: CROP lenacrop = imcrop(lena [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 Imabsdiff mean 2: Average or mean of matrix elements std 2: Standard deviation of 2 D matrix elements 2 - 2 D 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 uint 8 and int 8, 2^16 for uint 16 and int 16, 2^16 for int 32, 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. lena. Noised=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 ready-to-use functions for processing an image/2 D 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
- Slides: 23