MATLAB CODES - Cropping of an Image

clear all;
close all;

% Read the Original Image
% Convert it to Grey Image, rescale it to 10 x 10 to reduce
% running time of this program and display it

mycolourimg = imread('colorleaf.jpg');
mygrayimg = rgb2gray(mycolourimg);

title('My original Image');

croppedimg = imresize(mygrayimg,[10 10]);
title('Cropped Image of size 10 x 10');

% Label the image for extraction of features

labelimage = croppedimg;
labelimage = bwlabel(labelimage);

% Obtain features of the image using regionprops() command
% The parameter all indicates that all the supported features
% to be displayed on screen

featuresimg = regionprops(labelimage,'Area','MajorAxisLength','MinorAxisLength');

% The individual features can be extracted like this

fprintf('Thre area is %6.2f \n',featuresimg.Area);
fprintf('The MajorAxisLength is %6.2f  \n',featuresimg.MajorAxisLength);
fprintf('The MinorAxisLength is %6.2f  \n',featuresimg.MinorAxisLength);

% Calculate eccenticity

myecc = featuresimg.MajorAxisLength/featuresimg.MinorAxisLength;
fprintf('The eccentricity is %6.2f \n',myecc);

% Calculate pixel statistics
% Convert the matrix to a single vector

newcropimg = croppedimg(:);

MATLAB CODES - Cropping of an Image MATLAB CODES - Cropping of an Image Reviewed by Suresh Bojja on 9/11/2018 06:26:00 AM Rating: 5
Theme images by sebastian-julian. Powered by Blogger.