EP375 Computational Physics

Slides:



Advertisements
Similar presentations
Sayfa 1 Department of Engineering Physics University of Gaziantep June 2014 Topic X BLACKBODY RADIATION EP324 Applied Optics.
Advertisements

Dr. Mubashir Alam King Saud University. Course Information Course Instructors: Dr. Mubashir Alam Contact Information: Office: 2C-98 Phone:
Electromagnetic Induction and Faraday’s Law
Physics for Scientists & Engineers, 3rd Edition
Chapter 6 Gravitation and Newton’s Synthesis Physics for Scientists & Engineers, 3 rd Edition Douglas C. Giancoli © Prentice Hall.
Chapter 33 Light: Reflection and Refraction Physics for Scientists & Engineers, 3 rd Edition Douglas C. Giancoli © Prentice Hall.
Sources of Magnetic Field
18 September 2007 KKKQ 3013 PENGIRAAN BERANGKA Week 11 – Ordinary Differential Equations 18 September am – 9.00 am.
Kinematics in Two Dimensions; Vectors
Lenses and Optical Instruments
Chapter 5 Further Applications of Newton’s Laws Physics for Scientists & Engineers, 3 rd Edition Douglas C. Giancoli © Prentice Hall.
Chapter 35 The Wave Nature of Light; Interference Physics for Scientists & Engineers, 3 rd Edition Douglas C. Giancoli © Prentice Hall.
Electric Charge and Electric Field
Chapter 2 Describing Motion: Kinematics in One Dimension Physics for Scientists & Engineers, 3 rd Edition Douglas C. Giancoli © Prentice Hall.
08 August 2007 KKKQ 3013 PENGIRAAN BERANGKA Assignment #2 – Systems of Nonlinear Equations 08 August pm – pm.
Dr. Jie Zou PHY Welcome to PHY 3320 Computational Methods in Physics and Engineering.
Understanding References for Physics Students. Introduction We will look at the content of common references that you may see on your reading list: –Journal.
Chapter 19 Heat and the First Law of Thermodynamics Physics for Scientists & Engineers, 3 rd Edition Douglas C. Giancoli © Prentice Hall.
Conservation of Energy
21 Aug 2007 KKKQ 3013 PENGIRAAN BERANGKA Week 7 – Interpolation & Curve Fitting 21 August am – 9.00 am.
Digital Image Processing & Pattern Analysis (CSCE 563) Course Outline & Introduction Prof. Amr Goneid Department of Computer Science & Engineering The.
BIL 101E Introduction to Computer and Information Systems 2011.
© 2007 Pearson Prentice Hall This work is protected by United States copyright laws and is provided solely for the use of instructors in teaching their.
General Relativity & Black Holes Jenn Felder and Nikki Linn Physics 220.
MTH 201 Discrete Mathematics Fall Term MTH 201 Discrete Mathematics Fall Term INTERNATIONAL BURCH UNIVERSITY DEPARTMENT of INFORMATION.
© Cambridge University Press 2013 Thomson_alphaem.
© Cambridge University Press 2013 Thomson_Fig
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
` Derrick Ankomah-Nyarko 1, Dr. Richard K. Ulrich 2 1 Berea College, Berea, KY, USA 2 University of Arkansas, Fayetteville, AR, USA Multivariate Analysis.
Digital Image Processing, 3rd ed. © 1992–2008 R. C. Gonzalez & R. E. Woods Gonzalez & Woods Chapter 1 Introduction Chapter.
Parts of a Light Microscope
Lecture #9 Analysis of fuselage frames using the force method.
Search Engine and SEO Presented by Yanni Li. Various Components of Search Engine.
EGR 115 Introduction to Computing for Engineers 3D animation in MATLAB Monday 17 Nov 2014 EGR 115 Introduction to Computing for Engineers.
ENG 1181 College of Engineering Engineering Education Innovation Center MatLab – 2D Plots 2 MATLAB has many built-in functions and commands to create various.
Introduction to Matlab Module #8 Page 1 Introduction to Matlab Module #8 – Animation Topics 1.getframe 2.pause 3.Plotting a set of files Textbook Reading.
MTH 204 NUMERICAL ANALYSIS Spring Term MTH 204 NUMERICAL ANALYSIS Spring Term DEPARTMENT of INFORMATION TECHNOLOGIES Assoc. Prof. Dr.
Chapter 15 Wave Motion Physics for Scientists & Engineers, 3 rd Edition Douglas C. Giancoli © Prentice Hall.
© Cambridge University Press 2013 Thomson_Fig
CE 474Dr SaMeH1 Photogrammetry (CE 474) [0] Associate Professor of Environmental Eng. Civil and Environmental Engineering Department Faculty of Engineering.
Beginning Programming for Engineers Animation. Special matrix functions >> clear >> ones(2,3) >> zeros(3,5) >> ones(2) >> zeros(3) >> eye(4) >> magic(4)
Welcome Welcome to environmental science! My name is Ms. Morford. “DO NOW” Please get out your notebook!! Number to page 9.
Coin Recognition Using MATLAB - Emad Zaben - Bakir Hasanein - Mohammed Omar.
Computer Application in Engineering Design
Q2 – What should you learn from this class?
Parts of a Light Microscope
© Cambridge University Press 2011
Applied Numerical Methods
Section 2.4 Circles Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall.
Lecture 1: Introduction
Simulation And Modeling
EP375 Computational Physics
Chapter 1: False-Position Method of Solving a Nonlinear Equation
Chapter 1: Introduction
Thomson_eeWWtgc © Cambridge University Press 2013.
Chapter 2 Excel Fundamentals
Mark Guzdial College of Computing/GVU Georgia Tech
Thomson_atlascmsEventsAlt
Signals and Systems Chapter 0: Course Policies
Applied Numerical Methods
Tutorial 1 (additional materials)
Matlab tutorial course
Thomson_CandP © Cambridge University Press 2013.
Lecture 0 Preface Essential MATLAB for Engineers and Scientists
The Computer as a Medium for Sharing Knowledge
MATLAB stands for MATrix LABoratory.
Introduction To MATLAB
Thomson_AFBCartoon © Cambridge University Press 2013.
EP208 Computational Methods in Physics
The Department of Environment and Geography
Presentation transcript:

EP375 Computational Physics Topic 14 VIDEO PROCESSING Department of Engineering Physics University of Gaziantep Apr 2016

Content Example Applications Functions to be used: VideoReader() rgb2gray() im2bw() imshow() regionprops()

Introduction We have seen 2D or 3D plots of basic data. In this chapter we will discus some of the elementary processes that can be applied to images.

% vp0.m % frames to movie % get 1.bmp, 2.bmp and 3.bmp from course web page % http://www1.gantep.edu.tr/~bingul/ep375/ clear; clc; count = 0; Nframe = 3; Dframe = 5; mov = avifile('example.avi','compression','None'); for i=1:Nframe name = strcat(num2str(i),'.bmp'); v = imread(name); while count<Dframe count = count + 1; imshow(v); F = getframe(gca); mov = addframe(mov, F); end count = 0; mov = close(mov);

% vp1.m % reading video info clc; clear v = VideoReader('laser.avi'); t = v.Duration fr = v.FrameRate nFrame = uint32(t * fr) v1 = read(v,30); % get 30th frame imshow(v1) % diplay

% vp2.m % reading video info clc; clear v = VideoReader(‘freefall.avi'); t = v.Duration fr = v.FrameRate nFrame = uint32(t * fr) for i=1:nFrame v1 = read(v,i); % get ith frame imshow(v1) % diplay end

% vp3.m % reading video clc; clear %v = VideoReader('laser.avi'); v = VideoReader(‘fallingball3.avi'); t = v.Duration; fr = v.FrameRate; nFrame = uint32(t * fr); for i=1:nFrame A = read(v, i); % get ith frame B = rgb2gray(A); % convert to gray scale C = B>175; % convert to black-white subplot(2,2,1); imshow(A) subplot(2,2,2); imshow(B); subplot(2,2,3); imshow(C) pause(1/fr); end

% vp4.m % ccd clc; clear v = VideoReader('laser.avi'); t = v.Duration; fr = v.FrameRate; nFrame = uint32(t * fr); v1 = rgb2gray(read(v,1)); % get 1st frame v3 = rgb2gray(read(v,1)); % get 1st frame for i=2:nFrame v2 = rgb2gray(read(v,i)); v3 = v3 + imabsdiff(v1,v2); imshow(v3) end

% vp5.m % circles a = imread('circles.png'); g = rgb2gray(a); bw = g > 100; imshow(bw) stats = regionprops('table',bw,'Centroid',... 'MajorAxisLength','MinorAxisLength') centers = stats.Centroid; diameters = mean([stats.MajorAxisLength ... stats.MinorAxisLength],2); radii = diameters/2; hold on viscircles(centers,radii); hold off

% vp6.m % tracker clear; clc; v = VideoReader('laser.mp4'); t = v.Duration; fr = v.FrameRate; nFrame = uint16(t * fr); newvid = VideoWriter('newfile'); newvid.FrameRate=8; open(newvid) for k = 50:200 v1 = read(v,k); imshow(v1) v2 = im2bw(v1,0.8); stat = regionprops(v2); [w, h] = size(stat); if size(stat) > 0 rectangle('Position', stat(1).BoundingBox, 'EdgeColor', 'b'); cX = stat(1).Centroid(1); cY = stat(1).Centroid(2); fprintf('%d %d\n',cX,cY); end frame = getframe; writeVideo(newvid,frame); close(newvid)

% vp7.m % measurement of gravitational acceleration from video clear; clc; v = VideoReader('fallingball7.avi'); nFrame = uint16(v.Duuration * v.FrameRate); v1 = read(v,1); % get first frame for k = 2:nFrame v2 = read(v,k); v3 = imabsdiff(v1,v2); v4 = im2bw(v3,0.2); imshow(v4); stat = regionprops(v4); if size(stat) > 0 rectangle('Position', stat(1).BoundingBox,'EdgeColor', 'g'); cX = stat(1).Centroid(1); cY = stat(1).Centroid(2); fprintf('%d -> %d %d\n',k,cX,cY); T(k) = double(k)/fr; y(k) = cY; end frame = getframe; % size of ping ball is 42mm which corresponds 15px in the video t = T(2:end); y = (v.Height-y(2:end)) * 42e-3/15; plot(t,y,'*')

References: [1]. Numerical Methods for Engineers, 6th Ed. S.C. Chapra, Mc Graw Hill (2010) [2]. http://www.mathworks.com/products/matlab [3]. Numerical Methods in Engineering with MATLAB, J. Kiusalaas, Cambridge University Press (2005) [4]. Essential MATLAB for Engineers and Scientist, 3rd Ed Hahn B., Valentine D.T. (2007) [5]. Computational Physics, Giordano J.N. Prentice Hall (1997)