RoboCarts
Classes | Functions
ga_classes Namespace Reference

Classes

class  Blob
 
class  Car
 

Functions

def delete_unused_blobs (existing_blobs, limit=10)
 
def get_centroid (contour)
 
def find_car (cars, name)
 
def union (rect1, rect2)
 
def intersection (rect1, rect2)
 
def rect_intersection (rect1, rect2)
 
def rect_union (rect1, rect2)
 
def contours_iou (cnt1, cnt2)
 
def tl_br_to_xywh (rectangle)
 
def find_best_match (results)
 
def adjust_contour_img_to_template (contour_img, template)
 
def eval_template (template, contour_img)
 
def softmax (x)
 
def normalize_score (results)
 

Detailed Description

@file ga_classes.py
@brief This file contains classes for the General algorithm

Function Documentation

◆ adjust_contour_img_to_template()

def ga_classes.adjust_contour_img_to_template (   contour_img,
  template 
)
Function for resizing the source image and template for template matching
:param contour_img: source image
:param template: template
:return: resized source image

◆ contours_iou()

def ga_classes.contours_iou (   cnt1,
  cnt2 
)
Computes IoU of two contours
:param cnt1: contour 1
:param cnt2: contour 2
:return: contours IoU

◆ delete_unused_blobs()

def ga_classes.delete_unused_blobs (   existing_blobs,
  limit = 10 
)
Auxiliary function for deleting unused blobs from the programs memory
:param existing_blobs: list of existing blobs
:param limit: limit of consecutive frames that the blobs can be absent from
:return: new list of blobs

◆ eval_template()

def ga_classes.eval_template (   template,
  contour_img 
)
Computes the template matching's similarity score and location
:param template: reference image
:param contour_img: contour image
:return: score, rectangle(tl-br)

◆ find_best_match()

def ga_classes.find_best_match (   results)
Finds the best matching combination of cars to a cluster
:param results: results of the 'match_car_tuple' function
:return: best matching combination of cars

◆ find_car()

def ga_classes.find_car (   cars,
  name 
)
Auxiliary function that finds a Car instance based on its name/id
:param cars: Car instance
:param name: name
:return: Car instance with the name

◆ get_centroid()

def ga_classes.get_centroid (   contour)
Computes the centroid position of a contour
:param contour: contour
:return: centroid's coordinates

◆ intersection()

def ga_classes.intersection (   rect1,
  rect2 
)
Finds the intersection of two rectangles
:param rect1: rectangle 1
:param rect2: rectangle 2
:return: intersection rectangle

◆ normalize_score()

def ga_classes.normalize_score (   results)
Normalizes similarity scores with the softmax
:param results: dictionary of similarity scores (car_name : score)
:return: dictionary of normalized similarity scores

◆ rect_intersection()

def ga_classes.rect_intersection (   rect1,
  rect2 
)
Computes the size of intersection area of two rectangles
:param rect1: rectangle 1
:param rect2: rectangle 2
:return: intersection area

◆ rect_union()

def ga_classes.rect_union (   rect1,
  rect2 
)
Computes the size of union area of two rectangles
:param rect1: rectangle 1
:param rect2: rectangle 2
:return: union area

◆ softmax()

def ga_classes.softmax (   x)
Computes the softmax value of a vector
:param x: vector
:return: softmax(x)

◆ tl_br_to_xywh()

def ga_classes.tl_br_to_xywh (   rectangle)
Transfers a rectangle from top-left, bottom-right format to x,y,width,height format
:param rectangle: rectangle in tl-br format
:return: rectangle in x,y,w,h format

◆ union()

def ga_classes.union (   rect1,
  rect2 
)
Finds the union of two rectangles
:param rect1: rectangle 1
:param rect2: rectangle 2
:return: union rectangle