Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c l c ; clear all; close all; vid 9 0 = VideoReader ( SAE _ 9 0 _ teja.MOV ) ; no _

clc;
clear all;
close all;
vid90= VideoReader("SAE_90_teja.MOV");
no_of_frames = vid90.NumFrames;
time = vid90.Duration;
frame_rate = vid90.FrameRate;
for i=1:1 :no_of_frames
filename = strcat("frame90-", num2str(i),'.jpg');
a=read(vid90,i);
imwrite(a,filename);
a= imrotate (a,1.13);
g=imcrop(rgb2gray(a),[580,0,105,1600]);
imwrite(g,filename):
end
base_img = imread('frame90-13.jpg');
base_img = histeq(base_img);
threshold =16;
binaryMask = base_img >= threshold;
base_img = base_img .* uint8(binaryMask);
bw_img = imbinarize(base_img, "global");
in_frame =320;
fin_frame =390;
k= in_frame-1;
for j= in_frame:1:fin_frame
img_read = imread(['frame90-', num2str(j),'.jpg ']);
img_read = histeq (img_read);
threshold =16;
binaryMask = img_read threshold;
img_read = img_read.** uint8(binaryMask);
bw_img1= imbinarize(img_read, "global");
diff_img = bw_img1- bw_img;
diff_img = diff_img;
SE= strel('disk'{:?-,5);
dil_img = imdilate(diff_img,SE);
subplot (1,2,1);
imshow(dil_img);
Image = dil_img;
hold on
axis on
B1= sum(dil_img, 2);
[minValue, minIndex]=min(B1);
y-loc (j-k,1)=j;
y-loc (j-k,2)= minIndex **(0.6121000);
t(j-k,1)=j30;
pause(0.05)
end
pos_time =[t,yloc(:,2)];
degree =1;
coefficients = polyfit(pos_time((1:31),1), pos_time((1:31),2),
xFit = linspace (10.6667,11.667,100);
yFit = polyval(coefficients, xFit;
figure(2)
subplot (2,1,1)
plot(pos_time ( : ,1), pos_time( : ,2));
hold on;
plot(xFit, yFit, 'r-', 'LineWidth', 2);
hold off;
xlabel('Time(s)');
ylabel('Location of ball');
title('Curve fitting for Location-Time');
legend('Original Points', 'Fitted Curve');
slopeCoefficients = polyder(coefficients);
slopeCurve = polyval(slopeCoefficients, xFit);
subplot (2,1,2);
plot(xFit, slopeCurve, 'g-', 'LineWidth', 2);
xlabel('Time');
ylabel('Velocity');
title('Velocity Time Curve');
velocity = polyval(slopeCoefficients,21);
% Viscocity Calculation
dia =6.3e-3;
rho_1=870;
rho_b =8000;
g=9.81;
viscocity rho_b - rho_1{:)**(g)**dia???2 velocity
I want this programme in matlab with some changes
This programe is showing arrey exceed maximum arrey error
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Influxdb Database A Comprehensive Guide To Learn Influxdb Database

Authors: Cybellium Ltd ,Kris Hermans

1st Edition

B0CNGGWL7B, 979-8867766450

More Books

Students also viewed these Databases questions