Top Internet of Things Daily & Weekly

IoT Face Tracking And Recognition

Wireless face tracking and recognition with Arduino + Android:

  • It’s a great project to get you started with simple DIY maker projects.
  • println ( in_message ); #endif // get value for horizontal servo from mobile val_x = atoi ( data_servo_x ); // read last servos positions pos_x = servo_x .
  • println ( “Initialize CC3000 OK” ); #endif } uint8_t connection_cnt = 0 ; while ( connection_cnt <= WL_MAX_ATTEMPT_CONNECTION ) { if ( ! wifi .
  • if ( val_x < ( FRAME_WIDTH / 2 - inc_x )) { if ( pos_x >= inc_x ) pos_x += DISTANCE_X ; // calculate X position to move to the left.
  • else if ( val_x > FRAME_WIDTH / 2 + inc_x ) { if ( pos_x <= SERVO_MAX_X - inc_x ) pos_x -= DISTANCE_X ; // calculate X position to move to the right.

Wireless Face Tracking And Recognition Arduino + Android. Find this and other hardware projects on Hackster.io.

@arduino: Wireless face tracking and recognition with Arduino + Android:

The advancement and development of high resolution per frame cameras in recent years motivate both engineers and students in the research and creation of applications based on “automated” computer vision algorithms, a frequent task used in the tracking of object movements and position as well as its own characteristics, such as object shape, object color, etc.

In this case, the project is based on the tracking and recognition of faces, If it detects a face it focuses it within a red frame, if it recognizes it in a lower percentage the focus is within a yellow frame and if the percentage is high or very high it focuses it within a green frame.

The functionality of the project, I think, is simple but requires a bit of investigation.

Arduino Micro receives information about the object through a WiFi module, in this case the SparkFun Breakout Board CC3000 from IT. The communication is done through UDP sockets client server: the application in the mobile sends the necessary data (frame size and position for horizontal and vertical servo) to the microcontroller so that this can perform the calculations with the information sent and perform the updates in the servos, in this case only the horizontal.

I hope you enjoy this project and that it serves you a better project or investigative study or whatever you wish.

/* * Author : Zavala Ortiz Vicente Arturo. * language : .ino * Date : Friday April 18 2014. * Update : Friday June 06 2014. * Name : ATmega32u4_ServoFaceTrackingAndRecognition.ino * Description : Tracks circle coloresd objects */ #include /* servo libs */ #include “Servo.h” /* WiFi libs */ #include “CC3000.h” #include “CC3000_Client.h” #include “common.h” /* Servo and global variables */ #define SERVO_MAX_X 180 // max degree servo horizontal (X) can turn #define SERVO_CENTER_X 90 // center of X servo #define SERVO_PIN_X 10 // digital pin for servo X #define DISTANCE_X 5 // X servo rotation steps uint16_t FRAME_WIDTH = 320 ; // max screen horizontal uint8_t inc_x = 10 ; // increments of horizontal camera movement int val_x = 0 ; int pos_x = 0 ; Servo servo_x ; /* WiFi and global variables */ #define MAX_MSG_LEN 100 char ap_ssid [] = “Your network SSID” ; // SSID of network char ap_password [] = “Your network password” ; // Password of network unsigned int ap_security = WLAN_SEC_WPA2 ; // Security of network unsigned long timeout = 1000 ; // Milliseconds // Global Variables CC3000 wifi = CC3000 (); CC3000_Client client = CC3000_Client ( wifi ); char in_message [ MAX_MSG_LEN ] = { 0 }; static char data_servo_x [ 20 ]; static char data_frameWidth [ 20 ]; void setup () { /* add setup code here */ ConnectionInfo connection_info ; // Initialize CC3000 (configure SPI communications) #ifdef CC3000_DEBUG Serial . begin ( 115200 ); #endif // Initialize CC3000 (configure SPI communications) if ( ! wifi . init ( 9 )) { #ifdef CC3000_DEBUG Serial . println ( “Initialize CC3000 FAIL!” ); #endif return ; } else { //FreeRam(); #ifdef CC3000_DEBUG Serial . println ( “Initialize CC3000 OK” ); #endif } uint8_t connection_cnt = 0 ; while ( connection_cnt <= WL_MAX_ATTEMPT_CONNECTION ) { if ( ! wifi . connect ( ap_ssid , ap_security , ap_password , timeout )) { #ifdef CC3000_DEBUG Serial . println ( "Error: Could not connect to AP!" ); #endif } else break ; connection_cnt ++ ; _delay_ms ( 5000 ); } // Gather connection details and print IP address if ( ! wifi . getConnectionInfo ( connection_info )) { #ifdef CC3000_DEBUG Serial . println ( "Error: Could not obtain connection details" ); #endif return ; } else { #ifdef CC3000_DEBUG Serial . print ( "IP Address: " ); printIPAddr ( connection_info . ip_address ); #endif } pin_mode ( SERVO_PIN_X , OUTPUT ); // declare the servo pin as output servo_x . attach ( SERVO_PIN_X ); servo_x . write ( SERVO_CENTER_X ); // center servo } void loop () { /* add main program code here */ fulsh_buffer ( in_message ); #ifdef CC3000_DEBUG Serial . println ( "WAITING FOR MESSAGE!" ); #endif if ( client . readfrom ( 4444 , in_message , MAX_MSG_LEN ) == - 1 ) { #ifdef CC3000_DEBUG Serial . println ( "NO MESSAGE RECEIVED" ); #endif } if ( http_gets ( data_frameWidth , "frameWidth" , in_message )) { uint16_t width = atoi ( data_frameWidth ); if ( width > 320 ) { FRAME_WIDTH = width ; } fulsh_buffer ( data_frameWidth ); } if ( http_gets ( data_servo_x , “servoHoriz” , in_message )) { #ifdef CC3000_DEBUG Serial . println ( in_message ); #endif // get value for horizontal servo from mobile val_x = atoi ( data_servo_x ); // read last servos positions pos_x = servo_x . read (); /* Evaluate and calculate X */ // If circle is to the left of the middle screen. if ( val_x < ( FRAME_WIDTH / 2 - inc_x )) { if ( pos_x >= inc_x ) pos_x += DISTANCE_X ; // calculate X position to move to the left. } //If circle is to the right of the middle of the screen. else if ( val_x > FRAME_WIDTH / 2 + inc_x ) { if ( pos_x <= SERVO_MAX_X - inc_x ) pos_x -= DISTANCE_X ; // calculate X position to move to the right. } // Update Horizontal servo servo_x . write ( pos_x ); fulsh_buffer ( data_servo_x ); } }

IoT Face Tracking And Recognition