P 5
P 5
LAB-5
1. X shear
2. Y shear
3. Program for Xshear and Yshear
4. Program for getting negative of the image
AIM: Shear transformation in X direction
• % Read an image
• img = imread('peppers.png’);
•
• % Create a 2D affine transformation object
• tform = affine2d(shearing_matrix);
• % Apply the shearing to the image
• sheared_img = imwarp(img, tform);
• % Display the original and sheared images
• figure;
• subplot(1, 2, 1);
• imshow(img);
• title('Original Image');
• subplot(1, 2, 2);
• imshow(sheared_img);
• title('Sheared Image');
• AIM: Shear transformation in Y direction
• % Read an image
• img = imread('peppers.png');
•
•
• % Create a 2D affine transformation object
• tform = affine2d(shearing_matrix1);
•
•
•
•
• % Create a 2D affine transformation object
• tform = affine2d(shearing_matrix);
• % Apply the shearing to the image
• sheared_img = imwarp(img, tform);
• % Display the original and sheared images
• figure;
• subplot(1, 2, 1);
• imshow(img);
• title('Original Image');
• subplot(1, 2, 2);
• imshow(sheared_img);
• title('Sheared Image');
Point processing techniques
• AIM : Negative of the image
• % Read the image
• original_image = imread('peppers.png');
• % Convert the image to grayscale (if not already)
• gray_image = rgb2gray(original_image);
• % In case of 8 Bit image
• L = 256;
• % The below operation is equivalent to 255 - img
• s = (L - 1) - gray_image;
• figure,imshow(s); title('Inverted Image')
•
POINT PROCESSING TECHNIQUES
AIM :
Program to get negative of an image
• % Read the image
• original_image = imread('peppers.png');
• % Convert the image to grayscale (if not already)
• gray_image = rgb2gray(original_image);
• % Get the maximum intensity value based on the image type
• max_intensity = double(max(gray_image(:)));
• % Get the maximum intensity value based on the image type
• subplot(1, 2, 2);
• imshow(negative_image);
• title('Negative Image');