Minor Report Final-1
Minor Report Final-1
Detection
Submitted by
Satish Kumar S (RA2011004010070)
Kiran Akash S J (RA2011004010114)
Arunaachalam M (RA2011004010126)
Semester – VII
Academic Year: 2023-24
Dr. R. Dayana
Associate Professor,
Department of Electronics and Communication Engineering
NOV 2023
i
SRM Institute of Science and Technology
(Under Section 3 of UGC Act, 1956)
BONAFIDE CERTIFICATE
Certified that this project report titled “Object Detection Using Color
Thresholding and Contour Detection ” is the bonafide work of SATISH
KUMAR [Reg.No:RA2011004010070], KIRAN AKASH [Reg.No:
RA2011004010114], ARUNAACHALAM [Reg.No: RA2011004010126], who
carried out the project work under my supervision. Certified further, that to the
best of my knowledge the work reported herein does not form any other project
report or dissertation on the basis of which a degree or award was conferred on an
earlier occasion on this or any other candidate.
SIGNATURE SIGNATURE
ii
ABSTRACT
Object detection and tracking are fundamental tasks in computer vision that play
a vital role in enabling machines to perceive and interact with their environments.
Object detection involves recognizing and localizing objects within images or
video frames, often by drawing bounding boxes around them. This task goes
beyond simple classification, providing crucial information about object
locations. Various methods have been developed for object detection, including
traditional techniques utilizing handcrafted features, as well as deep learning
approaches using convolutional neural networks (CNNs). These methods find
applications in fields such as self-driving cars, surveillance, and robotics
iii
ACKNOWLEDGEMENTS
We would like to express our deepest gratitude to our guide. Dr. R. Dayana for
her valuable guidance, consistent encouragement, personal caring, timely help and
providing us with an excellent atmosphere for doing project. All through the work,
in spite of his busy schedule, she has extended cheerful and cordial support to us
for completing this project work.
iv
TABLE OF CONTENTS
ABSTRACT iii
ACKNOWLEDGEMENTS iv
LIST OF FIGURES vi
ABBREVIATIONS vii
1 INTRODUCTION viii
1.1 Problem Statement………………………………………………….viii
1.2 Engineering Standards ………………………… … …………… viii
1.3 Realistic Constraints………………………………………………ix
2 LITERATURE SURVEY xi
6 REFERENCE xix
7 APPENDIX xx
v
LIST OF FIGURES
Flow Chart…………………………………….xv
Output…………………………………………xvi
vi
ABBREVIATIONS
CNN-Convolutional Neural Network
CV - Computer Vision
vii
CHAPTER 1
INTRODUCTION
Object detection is a computer vision task that involves identifying and localizing objects
within an image or video frame. It goes beyond classification by not only recognizing what
objects are present but also drawing bounding boxes around them to indicate their locations.
Object tracking extends object detection by following objects as they move across frames in a
video sequence. It involves associating the same object's identity over time.
For instance, some key engineering standards and metrics applied to object detection tasks
include:
1. Accuracy Metrics: Measures like precision, recall, F1 score, mean Average Precision (mAP),
and Intersection over Union (IoU) are used to evaluate the accuracy and reliability of object
detection models. These metrics assess the model's ability to precisely locate and classify
objects within an image.
viii
2. Datasets: Engineering standards often rely on specific datasets like PASCAL VOC (Visual
Object Classes), COCO (Common Objects in Context), or ImageNet. These datasets contain
labeled images with various objects and are utilized for benchmarking the performance of
object detection models.
4. Training Protocols: Standards often encompass best practices in model training, validation,
and testing methodologies to ensure fairness and accuracy in the assessment of object detection
models.
The provided code does not adhere to these specific standards. Instead, it's a basic example
illustrating an elementary object detection approach using edge detection and contours. To meet
engineering standards, more sophisticated models trained on labeled datasets and validated
against specific metrics are typically employed.
1. Simplicity and Limitation: The approach is rudimentary and might not effectively handle
complex scenes, various lighting conditions, or objects with intricate backgrounds. It may
struggle to distinguish objects that are similar in color to the background or adjacent objects.
2. Lack of Specificity: This method solely detects edges and outlines of objects, which might
not accurately classify or precisely identify objects in detail. It's unable to recognize object
categories or fine-grained attributes.
3. Performance and Accuracy: The accuracy heavily depends on the quality of the edge
detection and the contours found. Noise or irregularities in the image may lead to inaccurate
results. It might not perform well in scenarios where objects have indistinct edges or are
partially occluded.
4. Limited Object Types: The method doesn't handle a wide variety of object types as it lacks
object-specific training or a diverse dataset to identify different categories of objects.
5. Speed and Efficiency: While this approach might be fast due to its simplicity, it might lack
efficiency and accuracy in complex scenes, making it unsuitable for real-time or production-
level applications.
ix
6. Not Scalable: It's not easily scalable to handle more complex scenarios or large datasets due
to its basic approach.
7. Dependency on Image Quality: The effectiveness heavily relies on the quality and clarity of
the input image. Noisy, low-resolution, or highly compressed images might negatively impact
the detection accuracy.
To overcome these constraints and create a more robust and accurate object detection system,
using pre-trained deep learning models, leveraging specific datasets for training, and
implementing neural networks that can learn object features from a wide variety of images are
commonly preferred in modern object detection applications.
x
CHAPTER 2
LITERATURE SURVEY
1. Author: Joseph Redmon, Santosh Divvala, Ross Girshick, and Ali Farhadi. "You Only Look
Once: Unified, Real-Time Object Detection" Date: 2016 - Prior work on object detection
repurposes classifiers to perform detection. Instead, we frame object detection as a regression
problem to spatially separated bounding boxes and associated class probabilities.
2. Author: Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. "Faster R-CNN: Towards
Real-Time Object Detection with Region Proposal Networks" Date: 2016 - A single neural
network predicts bounding boxes and class probabilities directly from full images in one
evaluation. Since the whole detection pipeline is a single network, it can be optimized end-to-
end directly on detection performance.
3. Author: Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed,
Cheng-Yang Fu, and Alexander C. Berg. "SSD: Single Shot MultiBox Detector" Date: 2016 -
Our unified architecture is extremely fast. Our base YOLO model processes images in real-
time at 45 frames per second. A smaller version of the network, Fast YOLO, processes an
astounding 155 frames per second while still achieving double the mAP of other real-time
detectors.
4. Author: Joseph Redmon and Ali Farhadi. "YOLOv3: An Incremental Improvement" Date:
2018 - YOLO makes more localization errors but is far less likely to predict false detections
where nothing exists. Finally, YOLO learns very general representations of objects. It
outperforms all other detection methods, including DPM and R-CNN, by a wide margin when
generalizing from natural images to artwork on both the Picasso Dataset and the People-Art
Dataset.
5. Author: Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. "Mask R-CNN"
Date: 2017 - datasets like COCO (Common Objects in Context), PASCAL VOC (Visual Object
Classes), and their significance in evaluating object detection models.
xi
CHAPTER 3
PROPOSED SYSTEM
Real-Time or Batch Processing: Enhance the system to handle real-time video streams for
continuous object detection or batch processing for multiple images in a folder. Error Handling
and Feedback: Implement error handling to provide meaningful feedback in case of errors, such
as file not found, invalid image format, or detection failures. Documentation and Usage
Guidelines: Include clear documentation, comments within the code, and a user guide, outlining
how to use the system, configure parameters, and interpret results. Performance Optimization:
Optimize the code for speed and resource efficiency, enabling faster processing, especially if
handling large images or real-time streams. Expandable Model Support: Make the system
extensible to easily integrate new object detection models, allowing future upgrades without
major code changes. Testing and Validation: Set up a testing framework to validate the system's
accuracy, performance, and reliability across various scenarios and datasets.
xii
CHAPTER 4
COMPONENTS USED
HP Pavilion
Microprocessor
Intel® Core™ i7-7500U (2.7 GHz base frequency, up to 3.5 GHz with Intel® Turbo Boost
Technology, 4 MB cache, 2 cores)
Flash cache
8 GB
Memory, standard
Video graphics
Hard drive
Operating system
Windows 11
xiii
4.3 WORKING
The provided Python code performs a basic form of object detection using color thresholding
and contour detection. It utilizes the OpenCV library for image processing. Initially, the code
reads an image file specified by the path ('your_image.jpg'). It then defines a color range using
lower and upper limits in the BGR (Blue-Green-Red) format to identify the color of the object
to be detected within the image. The script converts the image to the HSV (Hue-Saturation-
Value) color space, simplifying the process of color segmentation by better isolating the desired
color range. The next step involves creating a binary mask, marking the pixels that fall within
the specified color range.
The code then identifies contours within this mask using OpenCV's contour-finding function.
These contours outline areas of connected pixels sharing the same color characteristics. For
each detected contour, the script calculates a bounding rectangle and draws it onto the original
image. These rectangles demarcate the regions where the identified object is located. Finally,
the script displays the modified image, revealing the detected object enclosed within bounding
boxes. Users can adjust the color range parameters and experiment with different images to
detect objects based on distinctive colors. However, this method is basic and may not be highly
accurate or adaptable to various conditions compared to more advanced deep learning-based
object detection approaches like YOLO or SSD, which typically necessitate external models
and files for robust detection.
xiv
4.4 FLOW CHART
xv
CHAPTER 5
RESULT AND DISCUSSION
5.1 OUTPUT
Input Image
xvi
Output Image
In conclusion, the provided Python code demonstrates a simplistic approach to object detection
using color thresholding and contour detection without relying on external files or libraries
beyond OpenCV. It serves as a starting point for beginners to understand basic concepts in
image processing and contour analysis for object identification. While this method can detect
objects based on specific colors within an image, it's limited in accuracy and robustness,
particularly in scenarios with varying lighting conditions or complex backgrounds. For more
practical and reliable object detection, especially in real-world applications, leveraging pre-
trained deep learning models like YOLO, SSD, or Faster R-CNN would be more appropriate.
These models require external files and libraries to achieve more accurate and versatile object
detection capabilities across diverse and complex settings.
The field of object detection has seen significant advancements, particularly with the rise of
deep learning models and their applications. Techniques like YOLO (You Only Look Once),
Faster R-CNN, SSD (Single Shot MultiBox Detector), and Mask R-CNN have revolutionized
xvii
object detection by providing faster and more accurate methods for identifying and localizing
objects within images.
These models, introduced through influential papers by researchers like Joseph Redmon, Ali
Farhadi, Kaiming He, among others, have propelled the field forward. The development of
benchmark datasets such as COCO and ImageNet has facilitated a standardized approach for
evaluating the performance of object detection models, with metrics like mAP (mean Average
Precision) and IoU (Intersection over Union) serving as critical measures.
The challenges, however, persist. Object detection remains an active area of research due to the
complexities associated with detecting objects in varying contexts, handling occlusion, scale
variations, and dealing with real-time processing requirements. Furthermore, the trade-off
between speed and accuracy remains a key consideration in deploying these models for
practical applications.
Overall, the field continues to evolve, driven by ongoing research efforts to improve the
accuracy, efficiency, and versatility of object detection models, catering to diverse real-world
scenarios and applications, ranging from autonomous vehicles to surveillance systems, and
beyond. The future advancements are expected to focus on refining existing models and
creating innovative methodologies to address the challenges while improving the robustness
and real-time performance of object detection systems.
xviii
REFERENCES
1. Q. Zhao, P. Zheng, S. -T. Xu and X. Wu, "Object Detection With Deep Learning: A
Review," in IEEE Transactions on Neural Networks and Learning Systems, vol. 30, no.
11, pp. 3212-3232, Nov. 2019, doi: 10.1109/TNNLS.2018.2876865.
3. Z. Zou, K. Chen, Z. Shi, Y. Guo and J. Ye, "Object Detection in 20 Years: A Survey,"
in Proceedings of the IEEE, vol. 111, no. 3, pp. 257-276, March 2023, doi:
10.1109/JPROC.2023.3238524.
4. L. Jiao et al., "A Survey of Deep Learning-Based Object Detection," in IEEE Access,
vol. 7, pp. 128837-128868, 2019, doi: 10.1109/ACCESS.2019.2939201.
6. Authors: Ian Goodfellow, Yoshua Bengio, Aaron Courville. "Deep Learning" Date:
November 2016
7. Author: Aurélien Géron. "Hands-On Machine Learning with Scikit-Learn, Keras, and
TensorFlow" - Date: March 2019
8. Authors: Manisha Sharma, Jyotsna Kumar Mandal, Narendra Kumar Kamila. "Object
Detection in Computer Vision" - Date: November 2018
xix
APPENDIX
import cv2
import numpy as np
image = cv2.imread('your_image.jpg')
# Define the color range for the object you want to detect
# Create a binary mask where the object falls within the color range
xx
# Find contours in the mask
xxi