From 0fbcee962636946d6de8ec9b204d92f201de3d9d Mon Sep 17 00:00:00 2001 From: "Ragini.N" Date: Thu, 22 Oct 2020 09:40:37 +0000 Subject: [PATCH] Upload New File --- image processing and models/arrest3.m | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 image processing and models/arrest3.m diff --git a/image processing and models/arrest3.m b/image processing and models/arrest3.m new file mode 100644 index 0000000..09b6734 --- /dev/null +++ b/image processing and models/arrest3.m @@ -0,0 +1,52 @@ +clc; +close all; +for l = 2:21 + sum=0; +% l=9; +grayImage = strcat('e_images_', num2str(l), '.jpg'); +grayImage=imread(grayImage); +fontSize = 10; +maxRows = 0; +maxCols = 0; +for k = 1 : l + % read images..... + [rows, columns, numberOfSlices] = size(grayImage); + if rows > maxRows + maxRows = rows; + end + if columns > maxCols + maxCols = columns; + end +end +for k = 1:l + [rows, columns, numberOfColorBands] = size(grayImage); + if numberOfColorBands > 1 + grayImage = rgb2gray(grayImage); + end + figure(1); + subplot(2, 2, 1); + imshow(grayImage, []); + title('Original Grayscale Image', 'FontSize', fontSize); + end + +%% Extract left half and display histogram +middleColumn = floor(columns/2); +leftHalfImage = grayImage(:,1:middleColumn); +T = adaptthresh(leftHalfImage,0.5,'ForegroundPolarity','dark'); +binaryImage1= imbinarize(leftHalfImage,T); +figure(1); +subplot(2, 2, 2); +imshow(binaryImage1, []); +title('left half', 'FontSize', fontSize); +%% Extract right half and display histogram +middleColumn = floor(columns/2); +rightHalfImage = grayImage(:, middleColumn+1:end); +T = adaptthresh(rightHalfImage,0.5,'ForegroundPolarity','dark'); +binaryImage2= imbinarize(rightHalfImage,T); +figure(1); +subplot(2, 2, 3); +imshow(binaryImage2, []); +title('right half', 'FontSize', fontSize); + + + end \ No newline at end of file