Table of Contents

enablebox()

Function Definition: enablebox()

Parameters

Description

The function enables the automatic display of the landmark on pose/hand detected on the stage.

Example

The example demonstrates how to use hand recognition to track the different parts of the fingers in Python Coding Environment.

Code

thumb = Sprite('Thumb')
index = Sprite('Index')
middle = Sprite('Middle')
ring = Sprite('Ring')
pinky = Sprite('Pinky')

hand = Posenet()
hand.video("on", 0)
hand.enablebox()

thumb.switchcostume("ball-a")
thumb.setsize(50)
index.switchcostume("ball-b")
index.setsize(50)
middle.switchcostume("ball-c")
middle.setsize(50)
ring.switchcostume("ball-d")
ring.setsize(50)
pinky.switchcostume("ball-e")
pinky.setsize(50)

while True:
  hand.analysehand()
  
  if hand.ishanddetected():
    thumb.setx(hand.gethandposition(1, 4))
    thumb.sety(hand.gethandposition(2, 4))
    thumb.show()
    
    index.setx(hand.gethandposition(1, 8))
    index.sety(hand.gethandposition(2, 8))
    index.show()
    
    middle.setx(hand.gethandposition(1, 12))
    middle.sety(hand.gethandposition(2, 12))
    middle.show()
    
    ring.setx(hand.gethandposition(1, 16))
    ring.sety(hand.gethandposition(2, 16))
    ring.show()
    
    pinky.setx(hand.gethandposition(1, 20))
    pinky.sety(hand.gethandposition(2, 20))
    pinky.show()
  
  else:
    thumb.hide()
    index.hide()
    middle.hide()
    ring.hide()
    pinky.hide()

Output

Read More
The examples show how to use Pose Recognition in PictoBlox to count the number of body parts detected in the body in Python Coding Environment.

Code

sprite = Sprite('Tobi')
pose = Posenet()

pose.video("on", 0)
pose.enablebox()

while True:
  pose.analysecamera()
  bodyPartCount = 0
  
  for i in range(21):
    if pose.isdetected(i, 1):
      bodyPartCount += 1
  
  sprite.say(str(bodyPartCount) + " Parts Detected")

Output

Read More
All articles loaded
No more articles to load