Skip to content

4017CMD-2425/13870982_IPA_A2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Object Recognition Tool

Overview

This project implements an object recognition tool using computer vision techniques. The tool uses feature detectors and descriptors to detect and recognize objects in live video frames. It supports two feature detection algorithms: BRISK and SURF.

Requirements

  • Python 3.x
  • OpenCV library (opencv-python, opencv-contrib-python)
  • Numpy

How to Run

  1. Install the necessary dependencies:

    pip install opencv-python opencv-contrib-python numpy
    
  2. Run the main.py file to start object recognition from your webcam:

    python main.py
    
  3. The program will detect the object (defined in the img.png training image) and display it on the webcam feed with a bounding box around the object.


Functions

Recogniser class:

  1. __init__(self, detector): Initializes the object recognizer with the specified feature detector (BRISK or SURF).
  2. get_keypoints(self, _img): Detects keypoints in the provided image.
  3. get_descriptor(self, _img, _keypoints): Extracts descriptors for the detected keypoints.
  4. match(_d1, _d2): Matches descriptors between the training image and the frame.
  5. calculate_fps(_frame_number, _time): Calculates and returns the FPS of the webcam feed.
  6. detect_object(_training_image, _training_keypoints, _frame_keypoints, _filtered_matches): Detects the object from the frame using homography and matches.

main.py:

  • The main function sets up the recognizer, processes video frames from the webcam, and matches them to the training image.

Test Cases

1. Test - Object Recognition:

  • Description: Loaded a training image (img.png) and tested the system using a webcam.
  • Expected Outcome: The tool should detect and highlight the object in the webcam feed with a bounding box.
  • Actual Outcome: The object was successfully detected, and the bounding box was drawn around it.

2. Test - FPS Calculation:

  • Description: Tested FPS calculation by displaying the FPS on the webcam feed.
  • Expected Outcome: FPS should be calculated and displayed on the screen.
  • Actual Outcome: FPS was correctly displayed and updated in real time.

License

This tool is provided under the MIT license.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages