Deprecated: Required parameter $query follows optional parameter $post in /var/www/html/wp-content/plugins/elementor-extras/modules/breadcrumbs/widgets/breadcrumbs.php on line 1215
Face Detection - Blocks, Python Functions, Projects | PictoBlox Extension
[PictoBloxExtension]

Face Detection

Face
Extension Description
Detects and recognizes human faces with face landmark detections.

Introduction

Face detection is the action of locating human faces in an image and optionally returning different kinds of face-related data.

Face Detection in PictoBlox

PictoBlox uses feature-based detection to detect faces. Face landmarks are a set of easy-to-find points on a face, such as the pupils or the tip of the nose. By default, there are 68 predefined landmark points. The following image shows all landmark points:

Face Landmarks

Users can detect facial expressions using machine learning and algorithms to see emotions and recognize 6 basic facial or universal expressions in human faces. It does this by analyzing faces in images or video through cameras.

Face Recognition in PictoBlox

Face recognition systems allow programs to identify a person by analyzing the face landmarks of her/his face in a digital image.

PictoBlox allows you to run face recognition using the following process:

  1. When a face is analyzed, its geometrical properties, size, and position are obtained.
  2. A structure is generated that forms a pattern that is later stored in a database.
  3. Once stored, the user’s facial record is compared with the biometric features of each face that is scanned and allows adding new templates to make the recognition more effective.
  4. If the image matches a search, the system will alert us that a match has been found.

Face Detection

Accessing Face Detection in Block Coding

Following is the process to add Face Detection capability to the PictoBlox Project.

  1. Open PictoBlox and create a new file.
  2. Select the coding environment as Block Coding.
  3. Next, click on the Add Extension button and add the Face Detection extension.
  4. The face detection models will be downloaded, which may take a few seconds to load.
    Downloading Models
  5. Once downloaded you will get a message saying “Model loaded successfully”.
  6. You can find the face detection blocks available in the project.

Accessing Face Detection in Python Coding

Following is the process to add Face Detection capability to the PictoBlox Project.

  1. Open PictoBlox and create a new file.
  2. Select the coding environment as Python Coding.
  3. Next, click on the Add Modules/Libraries button and add the Face Detection extension.
  4. To access the library functions, you have to add the object declaration.
    fd = FaceDetection()
Read More

PictoBlox Blocks

This block facilitates the selection of your desired object.
Scripts that wear this block get converted into Arduino code when you are in Upload Mode. This block is used when one has to upload a code into evive.
All articles loaded
No more articles to load

Block Coding Examples

All articles loaded
No more articles to load

Python Functions

The function turns off all the LEDs of the Quarky.
Syntax: cleardisplay()
The function sets the threshold value of the specified IR sensor to the specified value. The value can be from 0 to 4095.
Syntax: setirthreshold(sensor = “IRL”, value = 1200)
The function stops both the motors of the Quarky robot.
Syntax: stoprobot()
The function stops the execution of the audio running on Quarky.
Syntax: stopaudio()
This function is used to analyze the image received as input from the stage, for the feature.
Syntax: analysestage()
This function is used to analyze the image received as input from the stage, for the handwritten and printed text.
Syntax: analysestage()
The function reports the last text detected from the speech.
Syntax: speechresult()
The function sets the place action angle with the specified angle. This is useful to set a custom place angle for the pick and place robot.
Syntax: setplaceangle(angle = 40)
The function is used to open a camera for video capture.
Syntax: cv2.VideoCapture(camera_id = 0)
The function performs the selected motion for the quadruped. The motion runs for the specified times and at the specified speed.
Syntax: move(motion = “forward”, time period = 1000, cycle = 1)
The function reports the state of the flame sensor connected to the selected pin. The function returns 1 when it is HIGH (or 3.3V) or 0 when it is LOW (or 0V).
Syntax: flamestatus(pin = “D3”)
The function creates a new feed with the specified name in the Adafruit IO account.
Syntax: adaio.createfeed(feed name = “feed name”)
The function makes the servo motors connected to the wheels orient inwards. This orientation is used for making the robot turn right and left efficiently.
Syntax: setinangle(Angle = 40)
The function calibrates the angles of the hip and foot servo motors and saves them in the memory of Quarky.
Syntax: sethandoffset(Left Hand Offset = 0, Right Hand Offset = 0)
The function causes the robot to move in a specified direction with a specified speed for a given amount of time before stopping automatically.
Syntax: runtimedrobot(direction = “forward”, speed = 100, time = 1000)
The function moves all the servo motors connected to the Quarky Expansion board servo ports 1 through 8.
Syntax: moveall(angle 1 = 90, angle 2 = 90, angle 3 = 90, angle 4 = 90, angle 5 = 90, angle 6 = 90, angle 7 = 90, angle 8 = 90, time = 1000)
The function is used to calculate the arcsine (inverse of the sine function) of the given value and return the arcsine in radians.
Syntax: math.asin(x)
This function sets all servo motors of a robotic arm to their default angle, referred to as the “home” position.
Syntax: roboticArm.sethome()
This function allows the robot to turn left or right to follow the next black line by setting the IR threshold and adjusting turn speed.
Syntax: turnrobotusingir(turn_direction = ‘left’, next_line = ‘next’)
This function is used to set the threshold for the confidence (accuracy) of face detection, 0 being low confidence and 1 being high confidence.
Syntax: setthreshold(threshold = 0.5)
The function changes its sprite’s costume to the next one in the costumes pane, but if the current costume is the last in the list, the block will loop to the first.
Syntax: nextcostume()
The function changes the specified sound effect by the values. The input is for selecting how much the sound will be changed. A positive number will make the sound effect have more effect, while a negative number will make it smaller.
Syntax: changesoundeffect(effect_name = “PITCH”, effect_value = 10)
The function will make an input box (with the specified text above it) show at the bottom of the screen. Users can input text into it and submit it, and the input is stored then in the Answer. The Answer automatic updates to the most recent input.
Syntax: input(question = “What is your name”)
If a sprite is currently using the pen because of the down() function, the up() function will cause the sprite to stop drawing a trail. (Otherwise, it has no effect.)
Syntax: up()
The function sets the analog state of the specified pin to the specified value between 0 to 255.
Syntax: setanalogoutput(pin)
The function sets the RGB LED matrix to the pattern specified in Pictoblox. The parameter passed is a 35 char string where each char corresponds to a color in the color palette.
Syntax: drawpattern(pattern = “aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”)
The function returns the state of the specified IR sensor. It returns True if the current IR sensor value is greater than the threshold value, else False.
Syntax: getirstate(sensor = “IRL”)
The function initializes the following line parameters for the Quarky robot – F. T1 and T2.
Syntax: initializelinefollower(F = 35, T1 = 40, T2 = 10)
The function plays the tone on the speaker for the specified note and duration. The duration is calculated by the factor.
Syntax: playtone(note = “C4”, duration_factor = 1)
This function is used to analyze the image received as input from the current backdrop image, for the feature.
Syntax: analysebackdrop()
All articles loaded
No more articles to load

Python Coding Examples

All articles loaded
No more articles to load
Table of Contents