Leçon 1, Chapitre 1
En cours

Reconnaissance gestuelle – Les fonctions python

Yann KIDSHAKER 17 mars 2025

Python Functions for Hand Recognition in PictoBlox

In order to use the functions for hand recognition in PictoBlox Python, we will use the Posenet class, for this we must first build the Posenet object by following the below steps:

  1. First, create a new project in PictoBlox and select Python Coding as your coding environment.
  2. Now write the below code in the scripting area. This code builds a Posenet object and stores it in the variable ‘pose‘.
pose = Posenet()

Functions for hand recognition in the Posenet class:

  1. analysehand():
    The above function analyzes the image (from camera or stage) and saves the hand information locally, which can be accessed using other functions, similar to computer vision.You have to run this function, every time you want to analyze a new image from the camera or stage.pose.analysehand()
  2. ishanddetected()
    This function is used to check if a hand is detected (from the camera or stage) or not. If it is detected then this function returns the value True, otherwise it returns False.pose.ishanddetected()
  3. gethandposition([1],[2], [3])
    The above function gets the position of the hand according to the Position (x, y), Part (top, middle, bottom), and Finger (thumb, index finger, middle finger, ring finger, pinky finger). By default the Position = 1 (x), the Part = 4 (top), and the Finger = 1 (thumb).Syntax of the function:
    gethandposition(POSITION ? [x position: 1, y position: 2], PART ? number [top: 4, middle 1: 3, middle 2: 2, bottom: 1], FINGER ? number [1: thumb, 2: index finger, 3: middle finger, 4: ring finger, 5: pinky finger])default: POSITION=1, PART=4, FINGER=1pose.gethandposition(1, 3, 5)
  4. gethandposition([1],[2])
    The above function gets the position of the hand according to the Position (x, y), and Part (top, middle, bottom) of the hand. By default, the Position = 1 (x), and the Part = 4 (top).Syntax:
    gethandposition(POSITION ? [x position: 1, y position: 2], PART ? number [top: 4, middle 1: 3, middle 2: 2, bottom: 1]):default: POSITION=1, PART=4pose.gethandposition(2, 3)
  5. handx() and handy()
    These functions get the x and y positions of the hand.pose.handx()
    pose.handy()