23ADE032– IMAGE AND VIDEO ANALYTICS
LABORATORY WORK BOOK
Name
Roll No
Branch
AI&DS
Year/Section
III Year
Semester
VI
Academic Year
23ADE032– IMAGE AND VIDEO ANALYTICS
Name
:
Class
: III Year AI&DS
Roll No
:
Certified that this is bonafide record of work done by the above student of the
III Year AI&DS
during the year
Faculty In-Charge
2025-2026
Head of the Department
Submitted for the Final Assessment held on
Internal Examiner 1
Internal Examiner 2
LIST OF EXERCISES
S. NO
1.
2.
3.
4.
5.
6.
DATE
NAME OF THE EXPERIMENT
PAGE.
NO
Write a program that computes the Tpyramid of an image
Write a program that derives the quad
tree representation of an image using the
homogeneity criterion of equal intensity.
Develop programs for the following
geometric transforms: (a) Rotation (b)
Change of scale (c) Skewing (d) Affine
transform calculated from three pairs of
corresponding
points
(e)Bilinear
transform calculated from four pairs of
corresponding points.
Develop a program to implement Object
Detection and Recognition.
Develop a program for Facial Detection
and Recognition.
Write a program for event detection in
video surveillance system
AVERAGE MARKS
SIGNATURE OF FACULTY
MARKS
(OUT OF 75)
FACULTY
SIGN
Dr. Mahalingam College of Engineering & Technology
19ADEN2016– IMAGE AND VIDEO ANALYTICS
Rubrics for Laboratory Exercises
Criteria
Excellent
Good
Satisfactory
Needs
Improvement
Preparation
(20 Marks)
Marks:20
Procedure for
implementation is
clearly defined.
Marks:18
Procedure for
implementation is
clearly defined
with missing
parameters.
Marks:15
Procedure for
implementation is
partially defined.
Marks:10
Procedure for
implementation
is partially
defined with
missing
parameters.
Marks:25
Implementation
addresses all
requirements of the
problem statement.
Marks:23
Implementation
addresses almost
all requirements
of the problem
statement.
Marks:19
Implementation
addresses most of
the requirements
of the problem
statement.
Marks:15
Implementation
addresses few
requirements of
the problem
statement.
Marks:15
Successful
execution of
almost all test
cases.
Marks:10
Successful
execution of most
of the test cases.
Marks:5
Execution of few
test cases.
Marks:8
Almost all the
questions are
correctly
answered.
Marks:5
Most of the
questions are
correctly
answered.
Marks:3
Few questions
are correctly
answered.
Observation
(25 Marks)
Marks:20
Interpretation Successful execution
of Result
of all test cases.
(20 Marks)
Viva
(10 Marks)
Total Marks
Marks:10
All the questions
are correctly
answered.
75
64
49
33
EX NO:01
WRITE A PROGRAM THAT COMPUTES THE T-PYRAMID OF AN IMAGE
Reading Material:
1. Introduction to Image Pyramids:
Understanding the concept of image pyramids.
Types of pyramids: Gaussian and Laplacian.
Application of image pyramids in image processing tasks such as multi-scale analysis,
image blending, and object detection.
2. Gaussian Pyramid:
Construction of a Gaussian pyramid: downsampling and smoothing.
Use of Gaussian filters in reducing the image size.
3. Laplacian Pyramid:
Construction of a Laplacian pyramid: using the Gaussian pyramid.
Importance of edge detection and image reconstruction.
4. Image Processing Libraries:
Overview of image processing libraries such as OpenCV (Python) or PIL (Python Imaging
Library).
Functions available for image resizing, filtering, and manipulation.
5. Algorithms for Constructing Pyramids:
Step-by-step algorithms for constructing Gaussian and Laplacian pyramids.
Example code snippets and explanations.
6. Applications of Image Pyramids:
Practical examples and use-cases where image pyramids are applied.
How T-Pyramids differ from traditional Gaussian or Laplacian pyramids.
EX NO:01
Date:
WRITE A PROGRAM THAT COMPUTES THE T-PYRAMID OF AN IMAGE
OBJECTIVE:
Students will be able to
•
Gain a comprehensive understanding of image pyramids and their importance in image
processing.
•
Apply the concept of T-Pyramids to a real-world image processing task.Design a
Bootstrap's grid system, components, and utilities to achieve a modern and functional
design.
AIM:
To write python program for T- pyramid of an image.
ALGORITHM:
Step1: First load the image
Step2: Then construct the Gaussian pyramid with 3 levels.
Step3: For the Laplacian pyramid, the topmost level remains the same as in Gaussian. The
remaining levels are constructed from top to bottom by subtracting that Gaussian level from its
upper expanded level.
PROGRAM:
import cv2
import numpy as np
import matplotlib.pyplot as plt
image = cv2.imread('im1.jpg')
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
G = image.copy()
gaussian_pyramid = [G]
for i in range(3):
G = cv2.pyrDown(G)
gaussian_pyramid.append(G)
laplacian_pyramid = []
laplacian_pyramid.append(gaussian_pyramid[-1])
for i in range(3, 0, -1):
GE = cv2.pyrUp(gaussian_pyramid[i])
GE = cv2.resize(GE, (
gaussian_pyramid[i-1].shape[1],
gaussian_pyramid[i-1].shape[0]
))
L = cv2.subtract(gaussian_pyramid[i-1], GE)
laplacian_pyramid.append(L)
plt.figure(figsize=(15,5))
for i in range(len(gaussian_pyramid)):
plt.subplot(1, 4, i+1)
plt.imshow(gaussian_pyramid[i])
plt.title(f'Gaussian Level {i}')
plt.axis('off')
plt.show()
plt.figure(figsize=(15,5))
for i in range(len(laplacian_pyramid)):
plt.subplot(1, 4, i+1)
img = cv2.normalize(
laplacian_pyramid[i],
None,0,255,cv2.NORM_MINMAX)
plt.imshow(img.astype(np.uint8))
plt.title(f'Laplacian Level {i}')
plt.axis('off')
plt.show()
OUTPUT:
Criteria
Marks
Preparation
/20
Observation
/25
Interpretation of Result
/20
Viva
/10
Total
/75
Faculty Signature with Date
RESULT:
Thus the python program for T-pyramid implemented and the output is obtained successfully.
EX NO: 02
WRITE A PROGRAM THAT DERIVES THE QUAD TREE
REPRESENTATION OF AN IMAGE USING THE HOMOGENEITY
CRITERION OF EQUAL INTENSITY.
Reading Material:
1. Introduction to Quad Trees:
Definition and basic concept of quad trees.
Applications of quad trees in image processing, computer graphics, and spatial indexing.
2. Image Representation with Quad Trees:
How quad trees can be used to represent 2D spatial data, specifically images.
Understanding the homogeneity criterion for dividing an image using quad trees.
3. Homogeneity Criterion:
Explanation of the homogeneity criterion based on equal intensity.
Techniques to determine if a region of an image is homogeneous.
4. Algorithms for Quad Tree Construction:
Step-by-step algorithms for constructing a quad tree from an image.
Recursive division of the image into quadrants based on the homogeneity criterion.
5. Image Processing Libraries:
Overview of image processing libraries such as OpenCV (Python) or PIL (Python Imaging
Library).
Functions available for image manipulation and analysis.
6. Practical Examples:
Example code snippets for constructing quad trees.
Case studies and practical applications of quad tree representations in image
compression and analysis.
WRITE A PROGRAM THAT DERIVES THE QUAD TREE
REPRESENTATION OF AN IMAGE USING THE HOMOGENEITY
CRITERION OF EQUAL INTENSITY.
.
EX NO:02
Date :
OBJECTIVE:
Students will be able to
•
Apply the concept of quad trees to a real-world image processing task.
•
Analyze the results and understand the benefits and limitations of using quad trees for
image representation.
AIM:
To write a python program for quad tree representation of an image using the
homogeneity criterion of equal intensity.
ALGORITHM:
Step1.Divide the current two dimensional space into four boxes.
Step2.If a box contains one or more points in it, create a child object, storing in it the two
dimensional space of the box
Step3.If a box does not contain any points, do not create a child for it.
Step4.Recurse for each of the children.
PROGRAM:
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import matplotlib.patches as patches
image_path = "dog.avif"
def load_image(path):
img = Image.open(path).convert('L')
img = img.resize((256, 256))
return np.array(img)
image = load_image(image_path)
plt.imshow(image, cmap='gray')
plt.title("Original Grayscale Image")
plt.axis('off')
plt.show()
def is_homogeneous(region, threshold=15):
return np.max(region) - np.min(region) < threshold
class QuadTreeNode:
def __init__(self, region, x, y, size):
self.x = x
self.y = y
self.size = size
self.children = []
self.value = None
if is_homogeneous(region) or size <= 4:
self.value = np.mean(region)
else:
self.subdivide(region)
def subdivide(self, region):
half = self.size // 2
self.children = [
QuadTreeNode(region[0:half, 0:half], self.x, self.y, half),
QuadTreeNode(region[0:half, half:self.size], self.x, self.y+half, half),
QuadTreeNode(region[half:self.size, 0:half], self.x+half, self.y, half),
QuadTreeNode(region[half:self.size, half:self.size], self.x+half, self.y+half, half)
]
def build_quadtree(image):
size = image.shape[0]
return QuadTreeNode(image, 0, 0, size)
quadtree = build_quadtree(image)
print("Quad Tree constructed successfully!")
def draw_quadtree(node, ax):
if node.children == []:
rect = patches.Rectangle(
(node.y, node.x),
node.size,
node.size,
linewidth=1,
edgecolor='red',
facecolor='none'
)
ax.add_patch(rect)
else:
for child in node.children:
draw_quadtree(child, ax)
fig, ax = plt.subplots(figsize=(6,6))
ax.imshow(image, cmap='gray')
draw_quadtree(quadtree, ax)
plt.title("Quad Tree Representation")
plt.axis('off')
plt.show()
OUTPUT:
Criteria
Marks
Preparation
/20
Observation
/25
Interpretation of Result
/20
Viva
/10
Total
/75
Faculty Signature with Date
RESULT:
Thus the python program for quad tree representation was implementation and output is
obtained successfully.
EX NO:03
DEVELOP PROGRAMS FOR THE FOLLOWING GEOMETRIC
TRANSFORMS: (A) ROTATION (B) CHANGE OF SCALE (C) SKEWING
(D) AFFINE TRANSFORM CALCULATED FROM THREE PAIRS OF
CORRESPONDING POINTS (E)BILINEAR TRANSFORM CALCULATED
FROM FOUR PAIRS OF CORRESPONDING POINTS.
Reading Material:
1. Introduction to Geometric Transformations:
Definition and types of geometric transformations.
Importance and applications in computer graphics and image processing.
2. Basic Transformations:
Rotation:
Mathematical formulation of 2D rotation.
Understanding the rotation matrix.
Scaling:
Mathematical formulation of scaling transformations.
Uniform vs. non-uniform scaling.
Skewing:
Mathematical formulation of skew transformations.
Horizontal and vertical skewing.
3. Affine Transformations:
Definition and properties of affine transformations.
Affine transformation matrix.
Calculation of affine transformations from three pairs of corresponding points.
Practical examples and applications.
4. Bilinear Transformations:
Definition and properties of bilinear transformations.
Bilinear interpolation and its importance.
Calculation of bilinear transformations from four pairs of corresponding points.
Practical examples and applications.
5. Image Processing Libraries:
Overview of image processing libraries such as OpenCV (Python) or PIL (Python
Imaging Library).
Functions available for performing geometric transformations.
6. Practical Examples:
Example code snippets for each geometric transformation.
Case studies and practical applications of geometric transformations in image
processing and computer graphics.
DEVELOP PROGRAMS FOR THE FOLLOWING GEOMETRIC TRANSFORMS:
(A) ROTATION (B) CHANGE OF SCALE (C) SKEWING (D) AFFINE
TRANSFORM CALCULATED FROM THREE PAIRS OF CORRESPONDING
POINTS (E)BILINEAR TRANSFORM CALCULATED FROM FOUR PAIRS OF
CORRESPONDING POINTS.
EX NO:03
Date:
OBJECTIVE:
Students will be able to
•
Apply the concepts of geometric transformations to real-world image processing tasks.
•
Analyze the results and understand the benefits and limitations of each transformation
method.
AIM:
To Develop programs for the following geometric transforms: (a) Rotation (b) Change of
scale (c) Skewing (d) Affine transform calculated from three pairs of corresponding points (e)
Bilinear transform calculated from four pairs of corresponding points.
ALGORITHM:
Step1: Create a 3×3 matrix with a 1 in the diagonal and the translation values in the last
column.
Step2: Compute the rotation matrix using trigonometric functions (sin and cos) and the given
rotation angle.
Step3: Create a 3×3 matrix with scaling factors along the diagonal and 1 in the last row and
column.
Step4: Create an affine transformation matrix with shear factors in the off- diagonal
elements.
Step5:Multiply the individual transformation matrices in the order you want to apply them.
Matrix multiplication is not commutative, so the order matters. The combined matrix
represents the sequence of transformations.
PROGRAM:
import cv2
import numpy as np
import matplotlib.pyplot as plt
image_path = "dog.avif"
img = cv2.imread(image_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
rows, cols = img.shape[:2]
M_rot = cv2.getRotationMatrix2D((cols/2, rows/2), 45, 1)
rotated = cv2.warpAffine(img, M_rot, (cols, rows))
scaled = cv2.resize(img, None, fx=1.5, fy=1.5)
M_shear = np.float32([[1, 0.5, 0],[0, 1, 0]])
skewed = cv2.warpAffine(img, M_shear, (int(cols + rows*0.5), rows))
pts1 = np.float32([[50, 50], [200, 50], [50, 200]])
pts2 = np.float32([[10, 100], [200, 50], [100, 250]])
M_affine = cv2.getAffineTransform(pts1, pts2)
affine = cv2.warpAffine(img, M_affine, (cols, rows))
pts1 = np.float32([[56, 65], [368, 52], [28, 387], [389, 390]])
pts2 = np.float32([[0, 0], [300, 0], [0, 300], [300, 300]])
M_pers = cv2.getPerspectiveTransform(pts1, pts2)
bilinear = cv2.warpPerspective(img, M_pers, (300, 300))
plt.figure(figsize=(10, 8))
plt.subplot(231)
plt.imshow(img)
plt.title("Original")
plt.axis("off")
plt.subplot(232)
plt.imshow(rotated)
plt.title("Rotation")
plt.axis("off")
plt.subplot(233)
plt.imshow(scaled)
plt.title("Scaling")
plt.axis("off")
plt.subplot(234)
plt.imshow(skewed)
plt.title("Skewing")
plt.axis("off")
plt.subplot(235)
plt.imshow(affine)
plt.title("Affine")
plt.axis("off")
plt.subplot(236)
plt.imshow(bilinear)
plt.title("Perspective")
plt.axis("off")
plt.show()
OUTPUT:
Criteria
Marks
Preparation
/20
Observation
/25
Interpretation of Result
/20
Viva
/10
Total
/75
Faculty Signature with Date
RESULT:
Thus the python program for geometric transforms implemented and output is obtained
successfully.
EX NO:04
DEVELOP A PROGRAM TO IMPLEMENT OBJECT DETECTION AND
RECOGNITION.
Reading Material:
1. Introduction to Object Detection and Recognition:
Definition and overview of object detection and recognition.
Difference between object detection and object recognition.
Applications in various fields like autonomous driving, security, and image retrieval.
2. Basic Concepts:
Overview of image processing and computer vision.
Key concepts such as features, descriptors, and classifiers.
3. Feature Extraction:
Techniques for feature extraction (e.g., SIFT, SURF, ORB).
Importance of features in object detection and recognition.
4. Object Detection Algorithms:
Traditional methods: Viola-Jones, Histogram of Oriented Gradients (HOG) + Support
Vector Machines (SVM).
Deep learning methods: Convolutional Neural Networks (CNNs), Region-based CNN
(R-CNN), Fast R-CNN, Faster R-CNN, You Only Look Once (YOLO), Single Shot
MultiBox Detector (SSD).
5. Object Recognition Algorithms:
Overview of classification algorithms.
Role of CNNs in object recognition.
Transfer learning and its applications in object recognition.
6. Training and Evaluation:
Dataset preparation and annotation.
Training deep learning models for object detection and recognition.
Evaluation metrics: Precision, Recall, F1 Score, mAP (mean Average Precision).
7. Implementation:
Introduction to popular frameworks: TensorFlow, Keras, PyTorch, OpenCV.
Steps to implement object detection and recognition using these frameworks.
Example code snippets and projects
EX NO:04
Date:
DEVELOP A PROGRAM TO IMPLEMENT OBJECT DETECTION AND
RECOGNITION.
OBJECTIVE:
Students will be able to
•
Develop a program to implement object detection and recognition using traditional and
deep learning methods.
•
Learn the differences and use cases for object detection versus object recognition.
•
Apply the concepts of object detection and recognition to real-world scenarios.
AIM:
To Develop a program to implement Object Detection and Recognition.
ALGORITHM:
Step1:Download the YOLO configuration file and weights from the official YOLO
website or a trusted repository.
Step2:The YOLO model and its configuration are loaded using OpenCV's dnn module.
Step3:The YOLO model processes the image to detect objects, and the bounding boxes,
class IDs, and confidences are extracted.
Step4:Non-maximum suppression is applied to remove redundant overlapping
bounding boxes.
Step5:Bounding boxes and labels are drawn on the image for the detected objects.
PROGRAM:
from ultralytics import YOLO
import cv2
model = YOLO("yolov8n.pt")
image_path = "picture.jpg"
results = model(image_path)
results[0].show()
results[0].save(filename="output.jpg")
print("Detection Completed")
OUTPUT:
Criteria
Marks
Preparation
/20
Observation
/25
Interpretation of Result
/20
Viva
/10
Total
/75
Faculty Signature with Date
RESULT:
Thus the python program for Object Detection and Recognition implemented and output
is obtained successfully.
EX NO:05
DEVELOP A PROGRAM FOR FACIAL DETECTION AND RECOGNITION.
Reading Material:
1. Introduction to Facial Detection and Recognition:
Overview of facial detection and recognition.
Differences between facial detection and facial recognition.
Applications in security, access control, and social media.
2. Basic Concepts:
Understanding images and pixel data.
Introduction to computer vision and image processing.
3. Facial Detection:
Techniques for facial detection (e.g., Haar Cascades, Histogram of Oriented
Gradients (HOG)).
Overview of deep learning methods for facial detection (e.g., Multi-task Cascaded
Convolutional Networks (MTCNN), YOLO, SSD).
4. Facial Recognition:
Techniques for facial recognition (e.g., Eigenfaces, Fisherfaces, Local Binary Patterns
(LBP)).
Overview of deep learning methods for facial recognition (e.g., DeepFace, FaceNet,
VGGFace).
5. Preprocessing and Feature Extraction:
Image preprocessing techniques: resizing, normalization, histogram equalization.
Feature extraction techniques: SIFT, SURF, ORB.
6. Machine Learning for Facial Recognition:
Introduction to classifiers: SVM, KNN, decision trees.
Training classifiers for facial recognition.
7. Deep Learning for Facial Recognition:
Introduction to Convolutional Neural Networks (CNNs).
Pre-trained models and transfer learning.
8. Implementation Frameworks:
Introduction to popular frameworks: OpenCV, Dlib, TensorFlow, Keras, PyTorch.
Steps to implement facial detection and recognition using these frameworks.
9. Practical Examples:
Example code snippets for facial detection and recognition.
Case studies and practical applications of facial detection and recogniti
EX NO:05
Date:
DEVELOP A PROGRAM FOR FACIAL DETECTION AND RECOGNITION.
OBJECTIVE:
Students will be able to
•
Develop a program to perform facial detection and recognition using traditional and
deep learning methods.
•
Apply the concepts of facial detection and recognition to real-world scenarios.
AIM:
To Develop a back end solution for a given scenario using Node JS.
ALGORITHM:
Step1:Download Dlib’s pre-trained facial landmark detector and facial recognition model.
Step2:Dlib’s pre-trained facial landmark detector and facial recognition model are loaded.
Step3:The input image is loaded and converted to grayscale for detection.
Step4:Faces in the image are detected using Dlib’s get_frontal_face_detector.
Step5:Face descriptors are computed using the face recognition model.
Step6:Bounding boxes and landmarks are drawn on the detected faces.
PROGRAM:
import face_recognition
import cv2
import numpy as np
from matplotlib import pyplot as plt
image_path = "picture.jpg"
image = face_recognition.load_image_file(image_path)
image_bgr = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
gray = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2GRAY)
face_locations = face_recognition.face_locations(image)
face_encodings = face_recognition.face_encodings(image, face_locations)
print("Number of faces detected:", len(face_locations))
for (top, right, bottom, left) in face_locations:
cv2.rectangle(image_bgr, (left, top), (right, bottom),
(0, 255, 0), 2)
plt.imshow(cv2.cvtColor(image_bgr, cv2.COLOR_BGR2RGB))
plt.axis('off')
plt.show()
for i, encoding in enumerate(face_encodings):
print(f"Face {i+1} descriptor length:", len(encoding))
OUTPUT:
Criteria
Marks
Preparation
/20
Observation
/25
Interpretation of Result
/20
Viva
/10
Total
/75
Faculty Signature with Date
RESULT:
Thus the python program for Facial Detection and Recognition was implemented and output
is obtained successfully.
EX NO:06
WRITE A PROGRAM FOR EVENT DETECTION IN VIDEO SURVEILLANCE
SYSTEM.
Reading Material:
1. Introduction to Video Surveillance Systems:
Overview of video surveillance systems and their applications.
Importance of event detection in video surveillance.
2. Basic Concepts:
Understanding video data and frame processing.Key concepts in video surveillance:
motion detection, object tracking, and event recognition.
3. Motion Detection:
Techniques for motion detection: frame differencing, background subtraction, optical
flow.Overview of popular algorithms: Mixture of Gaussians (MOG), Kalman filters,
Lucas-Kanade method.
4. Object Detection and Tracking:
Techniques for object detection: Viola-Jones, Histogram of Oriented Gradients (HOG),
deep learning methods (YOLO, SSD, Faster R-CNN).
Object tracking methods: centroid tracking, correlation filters, SORT, Deep SORT.
5. Event Detection and Recognition:
Definition of events in the context of video surveillance.
Techniques for event detection: rule-based methods, machine learning approaches,
deep learning methods (RNN, LSTM, 3D CNNs).
6. Machine Learning for Event Detection:
Introduction to classifiers: SVM, decision trees, random forests.
Training classifiers for event detection.
7. Deep Learning for Event Detection:
Introduction to recurrent neural networks (RNNs) and long short-term memory
networks (LSTMs).
Use of 3D CNNs for spatio-temporal event detection.
8. Implementation Frameworks:
Introduction to popular frameworks: OpenCV, TensorFlow, Keras, PyTorch.
Steps to implement event detection in video surveillance using these frameworks.
9. Practical Examples:
Example code snippets for motion detection, object tracking, and event
detection.Case studies and practical applications of event detection in video surveillance.
EX NO:06
Date:
WRITE A PROGRAM FOR EVENT DETECTION IN VIDEO SURVEILLANCE
SYSTEM.
OBJECTIVE:
Students will be able to
•
Develop a program to detect events in video surveillance using traditional and deep
learning methods.
•
Apply the concepts of event detection to real-world surveillance scenarios.
•
Analyze the results and understand the performance of different algorithms.
AIM:
To Write a program for event detection in video surveillance system
ALGORITHM:
Step1:The input video is loaded using OpenCV's VideoCapture.
Step2:Background subtraction is performed using the MOG2 algorithm to detect motion.
Step3:Contours of the detected moving objects are found and filtered based on area.
Step4:Bounding boxes are drawn around detected moving objects, and events are labeled on
the frame.
Step5:The processed frames and foreground mask are displayed.
PROGRAM:
import cv2
import numpy as np
from google.colab.patches import cv2_imshow
video_path = "video.mp4"
cap = cv2.VideoCapture(video_path)
if not cap.isOpened():
print("Error: Cannot open video file")
else:
print("Video loaded successfully!")
fgbg = cv2.createBackgroundSubtractorMOG2(history=500, varThreshold=50)
while True:
ret, frame = cap.read()
if not ret:
print("Video finished or cannot read frame.")
break
frame = cv2.resize(frame, (640, 480))
fgmask = fgbg.apply(frame)
kernel = np.ones((5, 5), np.uint8)
fgmask = cv2.morphologyEx(fgmask, cv2.MORPH_OPEN, kernel)
contours, _ = cv2.findContours(
fgmask,
cv2.RETR_TREE,
cv2.CHAIN_APPROX_SIMPLE
)
for contour in contours:
area = cv2.contourArea(contour)
if area > 1000:
x, y, w, h = cv2.boundingRect(contour)
cv2.rectangle(frame, (x, y), (x+w, y+h),
(0, 255, 0), 2)
cv2.putText(frame, "Motion Detected!",
(x, y-10),
cv2.FONT_HERSHEY_SIMPLEX,
0.7,
(0, 0, 255), 2)
cv2_imshow(frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
OUTPUT:
Criteria
Marks
Preparation
/20
Observation
/25
Interpretation of Result
/20
Viva
/10
Total
/75
Faculty Signature with Date
RESULT:
Thus the python program for event detection in video surveillance system was implemented and
output is obtained successfully..
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )