← Back to Projects
Computer Vision OpenCV YOLOv5 PyTorch

Computer Vision:
Harris, SIFT & YOLO

Harris · ORB · SIFT · YOLOv5
COCO (80 classes)
OpenCV · Ultralytics · PyTorch
Rubik's Cube + COCO Images
View on GitHub
5CV Algorithms Implemented
80COCO Object Classes
0.93Top Confidence Score (YOLO)
5Test Images Detected

Overview

A comprehensive computer vision assignment implementing five foundational algorithms: Harris Corner Detection, Image Pyramids, ORB feature detection, SIFT keypoint detection, and YOLOv5 real-time object detection on the COCO dataset.

Q1 — Harris Corner Detection

The Harris algorithm detects corners by analysing local intensity changes in multiple directions. Applied to a Rubik's Cube image — a geometrically rich subject with many well-defined corners. All 27 visible faces and edge intersections were correctly detected.

harris corner detection
corners = cv2.cornerHarris(image, blockSize=2, ksize=3, k=0.04)
corners = cv2.dilate(corners, None)
image_with_corners[corners > 0.01 * corners.max()] = [0, 0, 255]
Rubik's Cube — subject image
Subject image — used for Harris, ORB & SIFT detection

Q2 — Image Pyramid

Gaussian image pyramid constructed over 6 downsampling levels using cv2.pyrDown(). Applied to a building photograph to demonstrate multi-scale image representation — foundational for scale-invariant detection and image blending.

Building — Image Pyramid subject
Input image for Gaussian pyramid construction (6 levels)

Q3 — ORB Feature Detection

SURF is patent-restricted in OpenCV, so ORB (Oriented FAST and Rotated BRIEF) was used as a free, high-performance alternative. ORB detects keypoints and computes binary descriptors suitable for fast matching.

orb detector
orb = cv2.ORB_create()
keypoints, descriptors = orb.detectAndCompute(gray, None)
img_with_keypoints = cv2.drawKeypoints(
    image, keypoints, None, (255, 0, 0),
    flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS
)

Q4 — SIFT Keypoint Detection

SIFT (Scale-Invariant Feature Transform) detects and describes local features invariant to scale, rotation, and illumination changes. The rich circular keypoint visualisation shows scale and orientation for each detected feature.

sift detector
sift = cv2.SIFT_create()
keypoints, descriptors = sift.detectAndCompute(gray, None)
img_with_keypoints = cv2.drawKeypoints(image, keypoints, None)

Q5 — YOLOv5 Object Detection (COCO Dataset)

YOLOv5 (via Ultralytics) was loaded with pre-trained weights and run on 5 test images from the COCO dataset. YOLO performs single-pass detection — classifying and localising all objects in one forward pass.

yolo inference
from ultralytics import YOLO
model   = YOLO("yolov5s.pt")
results = model(img_rgb)
boxes   = results[0].boxes
# boxes.cls   → class IDs
# boxes.xyxy  → bounding box coords
# boxes.conf  → confidence scores
YOLO Detection Results — airplanes with 0.89 and 0.90 confidence
YOLOv5 detection — airplane at 0.89 & 0.90 confidence

YOLO Detection Results

Tech Stack