基于百度云人脸识别算法和4412开发板、外置摄像头实现人脸面部的采集,截取,识别,返回识别结果。
- 采用的软件有:putty软件(串行接口连接软件) Winscp软件(用于电脑和开发板的文件互传) ch341(终端驱动,确保电脑可识别开发板的端口)
- 配置环境:确保开发板与电脑网络互连:
- 检查互联网网络共享方法:打开电脑命令行(win+r输入cmd)确保电脑对开发板的网络互连:输入ping 192.168.137.2
- 检查互联网网络共享方法:打开putty,登录到开发板,在root界面输入上述指令,检查开发板与电脑的连接。
- 程序的烧写:
#include <stdio.h> #include <string.h> //memset #include <stdlib.h> //malloc free #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> //inet_ntop #include <unistd.h> //sleep #include <opencv2/opencv.hpp> #include <opencv2/freetype.hpp> #include "face.h" using namespace std; using namespace cv; using namespace aip; //前后图片的分隔字符串 #define BOUNDARY "boundary--" long get_file_size(const char *filename) { FILE *fp = fopen(filename, "r"); fseek(fp, 0, SEEK_END); long size = ftell(fp); fclose(fp); return size; } void send_file(FILE *fp, const char *filename) { long size = get_file_size(filename); char *body = (char *)malloc(size); FILE *file = fopen(filename, "r"); fread(body, 1, size, file); fclose(file); fwrite(body, 1, size, fp); free(body); } void send_buffer(FILE *fp, const char *buf, long size) { fwrite(buf, 1, size, fp); } Mat image; //core pthread_mutex_t image_lock = PTHREAD_MUTEX_INITIALIZER; Mat frame; pthre