Experiment-2: Basic Image Transformations Uncategorized by Ravinder Nath Rajotiya - January 31, 20250 Share on Facebook Share Send email Mail Print Print AIM: Create a program to demonstrate Geometric transformations- Image rotation, scaling, and translation. Objective: To Learn about the geometric transformation and the code in SCILAB Commands To Apply SCILAB Commands for getting the geometric transformation on images Requirement: PC installed with SCILAB on windows OS. Theory Image Representation: It is often necessary to perform a spatial transformation to: Align images that were taken at different times or with different sensors Correct images for lens distortion Correct effects of camera orientation Image morphing or other special effects Image rotation involves rotating an image by a certain angle. This technique is commonly used to correct image orientation, align objects, or create visually appealing effects Image scaling involves resizing an image to a desired size. This technique is useful for standardizing image dimensions, reducing memory consumption, or preparing images for specific applications. One use is where we try to resize the image according to the requirement. Image translation involves shifting an image’s pixels in the horizontal and vertical directions. This technique is useful for correcting alignment issues, creating image mosaics, or simulating camera movements. Shearing (Skewing) Except that Shearing displaces the pixel in one direction and as a result causes an inclined output to be produced. Identical to the rotation transformation, this transformation changes the angles between the axes of the image. we consider image transformations such as rotation, scaling and distortion (or undistortion!) of images. Such transformations are frequently used as pre-processing steps in applications such as document understanding, where the scanned image may be mis-aligned. There are two basic steps in geometric transformations: 1. A spatial transformation of the physical rearrangement of pixels in the image, and 2. a grey level interpolation, which assigns grey levels to the transformed image Table of Contents Toggle Types of Affine TransformationTranslationRotationScalingShearing Types of Affine Transformation Geometric transformations are based on the mathematical transformations in which the operations on the coordinates of the points of an image are performed. Such operations are always depicted by transformation matrices. For example: Translation Rotation Scaling Shearing SCILAB Code: 1st Example (Ref: https://bmsce.ac.in/Content/ML/DIP_Manual.pdf) I=imread(‘earcell.jpg’); subplot(2,2,1); subimage(I); title(‘Original Image’); s=input(‘Enter Scaling Factor’); j=imresize(I,s); subplot(2,2,2); subimage(j); title(‘Scaled Image’); % Rotation K=imrotate(j,60); subplot(2,2,3); imshow(K); title(‘Rotated Image 60deg’); R=imrotate(j,45); subplot(2,2,4); imshow(R); title(‘Rotated Image 45deg’) 2nd example s1 = imread( (“E:\E_DRIVE_DATA\RNR\BOOKs1\DIP\DIP Lab\Images\lena.jpg”)); [m,n]=size(s1); for i=1:m for j=1:n // scaling J(2*i,2*j)=s1(i,j); // Rotation p=i*cos(%pi/2)+j*sin(%pi/2); q=-i*sin(%pi/2)+j*cos(%pi/2); p=ceil(abs(p)+0.0001); q=ceil(abs(q)+0.0001); K(p,q)=s1(i,j); // shear Rotation u=i+0.2*j; v=j; L(u,v)=s1(i,j); end end imshow(s1); //original image imshow(J); //Scaling image imshow(K); //Rotation image imshow(L); //shear transformation image ( x d i r e c t i o n ) Image ’ ) ; 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. Study experiment https://help.scilab.org/docs/2025.0.0/en_US/rotate.html Share on Facebook Share Send email Mail Print Print