Skip to content

Repo containing the package bb_tools

Notifications You must be signed in to change notification settings

imatge-upc/BBTools

 
 

Repository files navigation

BBTools

BBTools is a Python library for bounding box manipulations.

Clone the repository

First, clone the project to your local machine:

git clone https://github.com/alexPhimanesone/BBTools.git

Installation

Make sure you're using Python 3.8 or later.

  1. Navigate to the project directory:

    cd BBTools
  2. Install the dependencies

    pip install requirements
  3. Install the package locally

    pip install .

Usage

Command line:

python unrotate_annotations.py --help
usage: unrotate_annotations.py [-h] [--annot_file ANNOTATION_FILE] [--out_file OUTPUT_FILE] [--p_length P_LENGTH] [--p_width P_WIDTH]

Convert from oriented bounding boxes in format [cx, cy, w, h, angle] to straight boxes in format [tlx, tly, w, h]

options:
  -h, --help            show this help message and exit
  --annot_file ANNOTATION_FILE
                        Name of the .csv file in MOTChallenge format.
  --out_file OUTPUT_FILE
                        Name of the output .csv file
  --p_length P_LENGTH   proportion of the length to remove in the corners.
  --p_width P_WIDTH     proportion of the width to remove in the corners.

Command line example:

python unrotate_annotations.py --annot_file data/annotation_example.csv --out_file annotation_example_straight.csv
# Plot straight rectangles on image
python plot_csv_rectangles.py

Calling from python:

import numpy as np
import bb_tools.obb_to_sbb

OBBs = np.array([[ 10.0,   5.0, 15.0, 20.0,  30],
                 [-20.0, -40.0, 20.0, 30.0, 300]])
SBBs, _ = bb_tools.obb_to_sbb.get_SBBs(OBBs, p_length=0.1, p_width=0.1)

About

Repo containing the package bb_tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%