Image Processing Reference
In-Depth Information
Cy = p.getYcoordinates()
// calculate dot product, see
Figure 2
r = (Cx-Ax)*(Ay-By) + (Cy-Ay)*(Bx-Ax)
if
( r > 0 )
then
// OVER THE LINE
if
( color_diff > threshold )
then
fire "Motion Detected" event
current_color(p) = RED
else
over the line but below threshold.
could make pixel transparent
else
// BELOW THE LINE
do nothing, we are not
interested in this area
Pseudo-code 6
//one thread for each pixel
foreach
pixel p
do
color_diff = prev_color(p) - curr_color(p)
// square of different
color_diff *= color_diff
// update previous color
prev_color(p) = curr_color(p)
// empirically chosen value.
// can be adjusted to make detector more
// or less sensitive to changes.
threshold = 5000
Cx = p.getXcoordinates()
Cy = p.getYcoordinates()
// calculate dot product, see
Figure 2
r = (Cx-Ax)*(Ay-By) + (Cy-Ay)*(Bx-Ax)
if
( r >= -200 && r <= 200 )
then
if
( color_diff > threshold )
then
fire "On Line Motion Detected" event
current_color(p) = RED
else
pixel on line, but no motion detected.
could make pixel green to show line
else
// OVER or BELOW THE LINE
do nothing, we are not
interested in these areas
It is similar in that this algorithm is also using a line defined by two points and the dot
product. However, if the dot product computed in Over a Line Motion Detector is equal to
zero, then the pixel in question is located on the line.
Search WWH ::
Custom Search