User Manual
Print

Putting Face Detection Result Inside Image

Face Detection Result mark face with … on photo

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>photo</variable><variable>faceDetectionResult</variable></variables><block type=\"UnaAI_FaceDetectionResult_markFaces\" disabled=\"true\" x=\"23\" y=\"113\"><field name=\"attribute\">FaceAttribute.Age</field><value name=\"faceDetectionResult\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">faceDetectionResult</field></block></value></block></xml>"}
				
			

This block is used for displaying the boundary box with different attributes inside the image.

Parameters:

      • AI Result (Face Detection from Azure)
      • Condition: age (Default)/emotion/gender/glasses type/major hair color/smile

Output: Image
Sample code:

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>photo</variable><variable>faceDetectionResult</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/AI5/samples/man1.jpg</field></shadow></value></block></value><next><block type=\"variables_set\"><field name=\"VAR\">faceDetectionResult</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"UnaAI_detectFaces\"><value name=\"img\"><block type=\"variables_get\"><field name=\"VAR\">photo</field></block></value></block></value><next><block type=\"UnaAI_FaceDetectionResult_markFaces\"><field name=\"attribute\">FaceAttribute.Age</field><value name=\"faceDetectionResult\"><block type=\"variables_get\"><field name=\"VAR\">faceDetectionResult</field></block></value></block></next></block></next></block></statement></block></xml>"}
				
			

The output:

Face Detection Result Mark Face With On Photo - Output