Pseudocode

We will need camera and speaker with facial recognition software. And a robotic arm.

Only if you understand what I wrote.

“The computer will take picture and recognize human faces. If there is no human face identified, the program would quit. If one or more faces are identified, the size of the largest face would be taken into account. If the face to picture ratio is less than 40%, the computer will take another picture and analyze again. If the ratio is more than 40% but less than 80%, it would increase the panic level by one and repeat the process again. However, if the ratio is more than 80%, it would lift the robotic arm, say “Wah!”, increase the panic level by 10 and quit the program.
If human faces were recognized by not directly facing the camera, then it is considered “head” in the program. If all human faces are facing to each other, it poses no threat to the computer but it will still keep watching until no more human faces traceable.”

Just for fun!

INIT: 
FACE_SIZE=0
PIC=TAKE_PICTURE
TOTAL_FACE=ANALYSE_FACE(PIC)
IF TOTAL_FACE=1 THEN
        TEMP_PIC=GET_FACE(PIC, 1)
        FACE_SIZE=SIZEOF(TEMP_PIC)/SIZEOF(PIC)*100

        GOTO CHECK_DISTANCE:
ELSEIF TOTAL_FACE>1 THEN
        TOTAL_HEAD=ANALYSE_HEAD(PIC)
        IF (TOTAL_HEAD>=0) AND (TOTAL_HEAD<TOTAL_FACE) THEN
                 FOR COUNT=1 TO TOTAL_FACE
                      TEMP_PIC=GET_FACE(PIC, COUNT)
                      TEMP_FACE_SIZE=SIZEOF(TEMP_PIC)/SIZEOF(PIC)*100
                      IF TEMP_FACE_SIZE>FACE_SIZE THEN
                                 FACE_SIZE=TEMP_FACE_SIZE
                       ENDIF
                       
                 NEXT COUNT
                 
                 INC(PANIC_LEVEL, TOTAL_FACE-TOTAL_HEAD)
                 GOTO CHECK_DISTANCE:
        ELSE
                 GOTO INIT:
        ENDIF
ELSE
        STOP
ENDIF

CHECK_DISTANCE:
IF FACE_SIZE<40 THEN
        GOTO INIT:
ELSEIF FACE_SIZE<80 THEN
        INC(PANIC_LEVEL, 1)
        GOTO INIT:
ELSE
        MOVE_ROBOTIC_ARM(UP, FULL_SPEED)
        DELAY(TWO_SECONDS)
        MOVE_ROBOTIC_ARM(UP, ZERO_SPEED)
        PLAY_VOICE("WAH")
        INC(PANIC_LEVEL, 10)
        STOP
ENDIF

This topic was automatically closed 95 days after the last reply. New replies are no longer allowed.