# HUSKYLENSPython **Repository Path**: jtion/HUSKYLENSPython ## Basic Information - **Project Name**: HUSKYLENSPython - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-20 - **Last Updated**: 2025-10-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
Author : Robert (robert@dfrobot.com)
Version : 0.1
Date : 08/04/2020
Github : Github
### Example Script > You can test out all the functions in our provided example script. Simply run `exampleHL.py` after changing the the connection settings in the beginning of the file. You will need a terminal / IDE to interact with the script.USB Connection (Mac/Windows/Linux -> Huskylens)
pip3 install pyserial pypng- Place the huskylib.py file within your projects folder
from huskylib import HuskyLensLibraryhl = HuskyLensLibrary("SERIAL", "/dev/ttyUSB0")print(h1.knock()Raspberry Pi (I2C -> Huskylens)
- Please refer to our full guide here:
- function_name(ARG1,ARG2,…)
- Description:
- Short description of functions overall inputs and its corresponding functionality
- Arguments:
- Arg1 : (Variable Type) Description
- Arg2 : (Variable Type) Description
- Returns:
- Short description the return value of the function, NONE if the function does not return
Description: Instantiate the HuskyLens class and automatically connect to your HuskyLens. This return the main object that you will run all functions on.
"COM_PROTOCOL" : (String) Either "SERIAL" for USB connections or "I2C" for Raspberry Pi I2C."COM_PORT" : (String) COM Port of the HuskyLens. Not needed for "I2C" connections."i2c_channel" : (Integer) I2C Channel, refer to Raspberry Pi Guide. Not needed for "SERIAL"."i2c_channel" : (Integer) I2C Channel, refer to Raspberry Pi Guide. Not needed for "SERIAL".Returns: Returns HuskyLens object
hl = HuskyLensLibrary("SERIAL", "/dev/ttyUSB0")hl = HuskyLensLibrary("I2C","", address=0x32, channel=0)Description: Send a simple knock to the HuskyLens to ensure that you are connected and can communicate.
Returns: Returns “Knock Received” on success
Description: Get the number of frame HUSKYLENS have processed.
Returns: Frame Count
Description: Get the number of learned and unlearned objects on the screen.
Returns: Number of Ojbects on the Screen
Description: Get the total number of learned objects for the current running algorithm, objects do not need to be present on screen.
Returns: Number of learned objects
Data Format
Data corresponds to either
blockinformation for all algorithms except Line Tracking, which instead will returnarrowinformation. These directly reflect the blocks/arrows you see on the HusyLens UI.class Block: Members: x => (Integer) x coordinate of the center of the square y => (Integer) y coordinate of the center of the square width => (Integer) width of the square height => (Integer) height of the square ID => (Integer) Objects ID (if not learned, ID is 0) learned => (Boolean) True if the object is learned type => "BLOCK" class Arrow: Members: xTail => (Integer) x coordinate of the tail of the arrow yTail => (Integer) y coordinate of the tail of the arrow xHead => (Integer) x coordinate of the head of the arrow yHead => (Integer) y coordinate of the head of the arrow ID => (Integer) Objects ID (if not learned, ID is 0) learned => (Boolean) True if the object is learned type => "ARROW"Returned data will be an array of either block or arrow information.:
**[block1 , block2, ... blockN]or[arrow1 , arrow2, ... arrowN]
[block1 , block2, ... blockN] or [arrow1 , arrow2, ... arrowN][block1 , block2, ... blockN][arrow1 , arrow2, ... arrowN][block1 , block2, ... blockN] or [arrow1 , arrow2, ... arrowN][block1 , block2, ... blockN][arrow1 , arrow2, ... arrowN]ID : (Integer) The desired ID of the object[block1 , block2, ... blockN] or [arrow1 , arrow2, ... arrowN]ID : (Integer) The desired ID of the object[block1 , block2, ... blockN]ID : (Integer) The desired ID of the object[arrow1 , arrow2, ... arrowN]Description: Switch the HuskyLens to a specific algorithm.
algorithmName : (String) The desired algorithm to switch to.“ALGORITHM_OBJECT_TRACKING”
“ALGORITHM_FACE_RECOGNITION”
“ALGORITHM_OBJECT_RECOGNITION”
“ALGORITHM_LINE_TRACKING”
“ALGORITHM_COLOR_RECOGNITION”
“ALGORITHM_TAG_RECOGNITION”
“ALGORITHM_OBJECT_CLASSIFICATION”
Returns: Returns “Knock Received” on success.
Description: Learn the current recognized object on screen with a chosen ID
ID : (Integer) The desired ID of the object (1-1023 range)Returns: Returns “Knock Received” on success.
Description: Forget learned objects for the current running algorithm.
Returns: Returns “Knock Received” on success.
"Name_Value" : (String) value for the desired nameobjectID : (Interger) value for the learned object ID you wish to changePlace a string of text (less than 20 characters) on top of the HuskyLens UI. The position of the texts (X,Y) coordinate is the top left of the text box.
You can have at most 10 custom texts on the UI at once, and if you continue adding texts you will replace previous texts in a circular fashion. For example, if you enter 10 texts you will fill the text buffer. If you then insert a new text object, you will overwrite the first text position (textBuffer[0]). Inserting another new text object will overwrite the second text position (textBuffer[1]).
Each text is uniquely identified by its (X,Y) coordinate, so you can replace the text string at a (X,Y) coordinate instead of adding a new text object. For example, if you insert “TEST_1” at (120,120) and then later submit “TEST_2” at (120,120), you will replace the string “TEST_1” with “TEST_2” and maintain an overall text count of 1.
"Text_Value" : (String) value for the desired textX : (Integer) The X coordinate for the UI Object (0-320)Y: (Integer) The Y coordinate for the UI Object (0-240)fileNum : (Integer) The specified file number to be used in the name for the filefileNum : (Integer) The specified file number to be used in the name for the file