This function returns the width of the object detected. You can specify the object for which the value is needed. The position is mapped with the stage coordinates.

Function Definition: width(object = 1)
| Name | Type | Description | Expected Values | Default Value | 
|---|---|---|---|---|
| object | int | Object number for which the information is required. | 1-100 | 1 | 
This function returns the width of the object detected. You can specify the object for which the value is needed. The position is mapped with the stage coordinates.

															sprite = Sprite('Square Box')
obj = ObjectDetection()
obj.disablebox()
obj.setthreshold(0.5)
obj.analysestage()
sprite.gotoxy(0, 0)
sprite.setsize(100)
sprite.say(str(obj.count()) + " Object Detected", 2)
for object in range(1, obj.count() + 1):
  sprite.setx(obj.x(object))
  sprite.sety(obj.y(object))
  sprite.setsize(obj.width(object))
  sprite.say(obj.classname(object) + " with " + str(obj.confidence(object)), 2)



															One of the most fascinating activities is face tracking, in which the Quarky can detect a face and move its head in the same direction as yours. How intriguing it sounds, so let’s get started with the coding for a face-tracking robot.
sprite = Sprite('Tobi')
quarky=Quarky()
import time
import math
humanoid = Humanoid(7,2,6,3,8,1)
fd = FaceDetection()
fd.video("on", 0)
fd.enablebox()
fd.setthreshold(0.5)
time.sleep(1)
Angle=0
while True:
  fd.analysestage()
  for i in range(fd.count()):
    sprite.setx(fd.x(i + 1))
    sprite.sety(fd.y(i + 1))
    sprite.setsize(fd.width(i + 1))
    Angle=fd.width(i + 1)
    angle=int(float(Angle))
    if angle>90:
      humanoid.move("left",1000,3)
    elif angle<90:
      humanoid.move("right",1000,3)
      time.sleep(1)
    else:
      humanoid.home()

															Copyright 2025 – Agilo Research Pvt. Ltd. All rights reserved – Terms & Condition | Privacy Policy