<< Chapter < Page Chapter >> Page >

High-level python implementation

The Python OpenCV library exposes an API for the entire Canny edge detection algorithm. The Canny algorithm issimilar to, but more nuanced than, our algorithm, substituting our selective thresholding procedure for hysteresis. However,the end results are very similar. As is evident from Listing 5, the procedure is very straightforward.

Listing 5. python implementation of canny edge detection with opencv

LOW_THRESHOLD = 100 HIGH_THRESHOLD = 200edges = cv2.Canny(img, LOW_THRESHOLD, HIGH_THRESHOLD)

Motion detection algorithm

Our motion detection algorithm compares the edges from two frames temporally separated by a small interval of time and attempts to estimate regions of the frame that exhibitmovement or motion. This process is then repeated continuously to provide a real-time visualization of the regions ofmovement in a continuous video stream. The motion detection algorithm we present is composed of the following steps:

  1. Given two frames F1 and F2 separated by a time interval of Δt, compute its edges E1 and E2.
  2. Create a strict binary difference matrix D0 between E1 and E2 whose value is high at locations at which anedge is present in frame but not the other, and low at locations at which both frames have an edge or no edge.
  3. Apply a parameter-controlled movement tolerance thresholding operation to the matrix D0 to obtainmatrix D, in order to suppress potential false positives of detected motion from incidental camera movement.

F1 and F2 are obtained by sampling frames from a continuous video stream, a task aided by the OpenCV C library.Thus, the time interval Δt will be small enough for a realtime algorithm. The edges E1 and E2 are computed with theedge detection algorithm of Section II. Below, we explore, in greater depth, the procedures for building a thresholdeddiffrence matrix and finally estimating the motion area by analyzing a spatial difference density map.

Thresholded frame-by-frame difference map

The preliminary requirement in determining areas of motion from two frames is a systematic method of determining andquantifying the differences between two frames separated by a small Δt. Intuitively, areas of motion within the time intervalΔt should exist at locations at which the difference between the two frames is large. This process is then continuouslyrepeated for every pair of input frames in order to create a realtime motion detector. In our algorithm, we quantify differenceson a binary basis using edge data from our edge detection algorithm, then determine motion locations from a thresholdeddensity map of the difference matrix D. More formally, we begin with a matrix D0 created from asimple comparison of E1 and E2. Then, for each location (i, j) in D0, a thresholded differencematrix D is created by considering a box of constant size b x b around that pixel and suppressing the value of the surroundingpixels to 0 if its value matches that at D0[i,j]. This step isdesigned to reduce false positives of motion detection arising from stray movement of the frame (e.g. camera shake). Thecomputation of D is demonstrated in Algorithm 2. The output matrix is then used as input to building a spatial differencedensity map, from which we estimate motion locations.

Questions & Answers

anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
China
Cied
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Elec 301 projects fall 2015. OpenStax CNX. Jan 04, 2016 Download for free at https://legacy.cnx.org/content/col11950/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Elec 301 projects fall 2015' conversation and receive update notifications?

Ask