Experiment-1 Basic Image Operations Uncategorized by Ravinder Nath Rajotiya - January 31, 20250 Share on Facebook Share Send email Mail Print Print Experiment-1: AIM: To understand the basic operations on images in SCILAB Objective: To Learn basic SCILAB Commands To Apply SCILAB Commands for Logical and Arithmetic Operations on images Requirement: PC installed with SCILAB on windows OS. Theory Image Representation: Assume that an image f(x, y) is sampled so that the resulting digital image has M rows and N columns as shown in the figure on right. The values of the coordinates (x, y) now become discrete quantities. If we consider integer values for these discrete coordinates, then it becomes a digital representation. The image data can be written in Matrix form as shown below and we can then perform various operations on this data. Basic Operations: Read Image Img=imread(‘path to image’); //give absolute path if it is on different path To read a file from a selected location from pop-up menu a=uigetfile(‘*.*’,’Select the Image:-‘); Display image Imshow(img); Size Size(img1) Img5=imresize(img1,[100,100]); (will change image size to 100×100 or img4=imresize(img1, 2) ; 2nd argument if 2 will dobbling the size, if 0.5 will half the size Logical Operations a=uigetfile(‘*.*’,’Select the Image:-‘); b=uigetfile(‘*.*’,’Select the Image:-‘); C=bitand(A, B); D=bitor(A, B); E=bitxor(A, B); F=bitcmp(A); figure(1); subplot(2,4,1);imshow(C); subplot(2,4,2);imshow(D); subplot(2,4,3);imshow(E); subplot(2,4,4);imshow(F); Arithmetic Operations: To increase or decrease brightness by some constant or add/subtract, multiply/divide images, as: a=uigetfile(‘*.*’,’Select the Image:-‘); b=uigetfile(‘*.*’,’Select the Image:-‘); C=imadd(A, B); D=imsubtract(A, B); E=immultiply(A, B); F=imdivide(A); figure(1); subplot(2,4,1);imshow(C); subplot(2,4,2);imshow(D); subplot(2,4,3);imshow(E); subplot(2,4,4);imshow(F); Conversion RGB2GRAY Img2=imread(“ ”); img5=rgb2gray(img2) Imshow(img5); Cropping an Image- We can crop image with an region of interest Imread(“”); Img3= imcrop(img2, [ 250,250,250,250]); here we need to give xy coordinate As x,y, x+c, x+r where Imshow(img3); Histogram img6=plot(imhist(img5)) Summary: In this lab we have studied basic operations on images. We are able to write SCILAB /or/MATLAB instructions and apply them on images. Share on Facebook Share Send email Mail Print Print