Object Oriented122
Object Oriented122
No: 06
Object Detection using machine learning algorithm.
DATE:
Objective:
Hardware Specification:
Device name VK
Processor 11th Gen Intel(R) Core(TM) i5-11300H @ 3.10GHz 3.11 GHz
Installed RAM 8.00 GB (7.79 GB usable)
Device ID BBA94BE2-3CDD-4885-9394-82846C493333
Product ID 00356-24577-04077-AAOEM
System type 64-bit operating system, x64-based processor
Pen and touch No pen or touch input is available for this display
Software Specification:
Python 3.12.2
Library installed
pip install opencv-python
pip install requests
Algorithm:
The provided program implements object detection using the Haar Cascade
Classifier for face detection in an image fetched from a URL. The algorithm
used in this program is the Haar Cascade Classifier, a machine learning-based
object detection algorithm.
try:
response = session.get(url)
response.raise_for_status()
img = Image.open(BytesIO(response.content))
img = np.array(img)
return img
except requests.exceptions.RequestException as e:
print(f"Error loading image from URL: {e}")
return None
RESULT:
When running the object detection program with the provided URL
https://assets.editorial.aetnd.com/uploads/2014/08/adolf-hitler-gettyimages-
92424893.jpg
which is a screenshot from the anime "One Piece," the program successfully
detects and highlights multiple faces in the image. The output image displayed
by the program shows red rectangles drawn around the detected faces of various
characters in the "One Piece" screenshot. The number of detected faces and the
accuracy of the bounding boxes may vary slightly due to factors such as image
quality and the performance of the pre-trained Haar Cascade Classifier model.