Table of Contents

Function Definition: x(object = 1)

Parameters

NameTypeDescriptionExpected ValuesDefault Value
objectintObject number for which the information is required.1-1001

Description

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

Example

The example demonstrates how to run an object detection on the stage and show all the objects with confidence.

Code

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)

Output

  1. Detection at 0.3
  2. Detection at 0.5
  3. Detection at 0.8
Read More
All articles loaded
No more articles to load