GithubHelp home page GithubHelp logo

danielc92 / cv2-drawing-boundingboxes Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.8 MB

A dynamic bounding box labelling function to draw boundaries around objects, including text.

Jupyter Notebook 100.00%

cv2-drawing-boundingboxes's Introduction

Drawing Bounding Boxes with cv2

A bbox labelling function to draw boundaries around objects, including text.

Before you get started

Knowledge of python 3.6.5 and cv2 library

Setup

How to obtain this repository:

git clone https//link.to.this.projects.git-repo

Modules/dependencies:

  • opencv-python

Install the following dependences:

pip install opencv-python

Usage

# Import modules
import cv2
from matplotlib import pyplot as plt

# Read in image (note default mode is BGR, to convert to RGB use cvtColor)
image = cv2.imread('./00a87e911c965a90.jpg')
rgb_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

# Use draw_rects() function to cast bounding boxes and text on image
image_draw = draw_rects(rgb_image, 
                        [(200,200, 245, 300),
                        (50,50, 120, 80),
                        (500,200, 245, 300)], 
                        'junk food', 
                        y_offset=20, 
                        border_colour=(33, 33, 183),
                        text_bg_colour=(33, 33, 183))

# Plot for verification purposes
plt.figure(figsize=(15,13))
plt.imshow(image_draw)

Tests

  • Testing drawing bounding box with text on sample image successfully.

Note: the location of the boxes are random numbers for testing purposes. Image

Contributors

  • Daniel Corcoran

Sources

cv2-drawing-boundingboxes's People

Contributors

danielc92 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.