Documentation

Una is developed by Una Technologies Limited

All rights reserved

© 2022 Una Technologies Limited

Print

Checking Object Detection Including Keyword

Vision Analysis Result Contains

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>photo</variable><variable>visionAnalysisResult</variable></variables><block type=\"UnaAI_VisionAnalysisResult_hasObject\" disabled=\"true\" x=\"112\" y=\"337\"><value name=\"visionAnalysisResult\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">visionAnalysisResult</field></block></value><value name=\"objName\"><shadow type=\"text\" disabled=\"true\"><field name=\"TEXT\"/></shadow></value></block></xml>"}
				
			

This is used to check whether the object contains specific terms.

Parameters:

      • AI Result (Object Detection from Azure)
      • Display setting: String

Output: Boolean (True/False)
Sample code:

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>photo</variable><variable>visionAnalysisResult</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">photo</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Resources_getPhotoByURL\"><value name=\"url\"><shadow type=\"text\"><field name=\"TEXT\">https://www.magicubedu.com/una/AI1/2.jpg</field></shadow></value></block></value><next><block type=\"variables_set\"><field name=\"VAR\">visionAnalysisResult</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"UnaAI_detectObjects\"><value name=\"img\"><block type=\"variables_get\"><field name=\"VAR\">photo</field></block></value></block></value><next><block type=\"controls_if\"><mutation else=\"1\"/><value name=\"IF0\"><shadow type=\"logic_boolean\"><field name=\"BOOL\">TRUE</field></shadow><block type=\"UnaAI_VisionAnalysisResult_hasObject\"><value name=\"visionAnalysisResult\"><block type=\"variables_get\"><field name=\"VAR\">visionAnalysisResult</field></block></value><value name=\"objName\"><shadow type=\"text\"><field name=\"TEXT\">Apple</field></shadow></value></block></value><statement name=\"DO0\"><block type=\"basic_consoleLogText\"><value name=\"text\"><shadow type=\"text\"><field name=\"TEXT\">It is an apple.</field></shadow></value></block></statement><statement name=\"ELSE\"><block type=\"basic_consoleLogText\"><value name=\"text\"><shadow type=\"text\"><field name=\"TEXT\">It is not an apple.</field></shadow></value></block></statement></block></next></block></next></block></statement></block></xml>"}
				
			

The output:

VisionAnalysisResult Contains - Output
Previous Object Detection Inside a Photo
Next Putting Object Detection Result Inside Image