Built-in Tracking Models

Import KOI 2 Library

from future import *
from koi2 import KOI2

Serial Initialization

koi = KOI2(tx, rx)

Initializes the serial connection to KOI.

Parameters:

tx: TX Pin, use P2 for Robotbit EDU

rx: RX Pin, use P12 for Robotbit EDU

Select Road Sign Tracking Mode

koi.setModel(1)

Sets the KOI mode to Road Sign Tracking.

Get Road Sign Coordinates

koi.xywh[0]

Returns coordinates for the detected road sign.

Parameters:

data: The type of data to return.

data
Meaning

0

X coordinates

1

Y coordinates

2

Width of road sign

3

Height of road sign

Get Road Sign Name

Returns the name of the road sign.

Values Returned: U-Turn, forward, left, right, limit-30, stop, tunnel

Sample Code: Road Sign Tracking

471B
Open

Select Common Items Tracking Mode

Sets the KOI mode to Common Items Tracking.

Get Item Coordinates

Returns coordinates for the detected item.

Parameters:

data: The type of data to return.

data
Meaning

0

X coordinates

1

Y coordinates

2

Width of item

3

Height of item

Get Item Name

Returns the name of the item.

Values Returned: aeroplane, bicycle, bird, boat, bottle, bus, car, cat, chair, cow, diningtable, dog, horse, motorbike, person, pottedplant, sheep, sofa, train, tvmonitor

Sample Code: Item Tracking

Select Alphabets Tracking Mode

Sets the KOI mode to Alphabet Tracking.

Get Alphabet Coordinates

Returns coordinates for the detected alphabet.

Parameters:

data: The type of data to return.

data
Meaning

0

X coordinates

1

Y coordinates

2

Width of alphabet

3

Height of alphabet

Get Alphabet Name

Returns the name of the alphabet.

Values Returned: A, B, C, D, E, F

Sample Code: Alphabet Tracking

Select Numbers Tracking Mode

Sets the KOI mode to Numbers Tracking.

Get Number Coordinates

Returns coordinates for the detected number.

Parameters:

data: The type of data to return.

data
Meaning

0

X coordinates

1

Y coordinates

2

Width of number

3

Height of number

Get Number Name

Returns the name of the number.

Values Returned: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Sample Code: Number Tracking

Last updated