Table of Contents

analysestage()

Function Definition: analysestage()

Parameters

Description

This function is used to analyze the image received as input from the stage, for objects.

Alert: This block processes the image input and updates the values in the other functions hence it needs to be put inside loops while making projects.

Example

The example demonstrates how to detect persons on the stage with different confidence thresholds.

Code

sprite = Sprite('Tobi')
obj = ObjectDetection()

obj.enablebox()
sprite.gotoxy(-180, -110)
sprite.setsize(100)

obj.setthreshold(0.3)
obj.analysestage()
sprite.say(str(obj.detectedcount("person")) + " Person Detected at 0.3 Threshold", 2)

obj.setthreshold(0.5)
obj.analysestage()
sprite.say(str(obj.detectedcount("person")) + " Person Detected at 0.5 Threshold", 2)

obj.setthreshold(0.9)
obj.analysestage()
sprite.say(str(obj.detectedcount("person")) + " Person Detected at 0.9 Threshold", 2)

Output

Read More
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