linux(ubuntu)人脸图片识别配置与实现
代码分析:
#include <stdio.h>
#include <curl/curl.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>#define true 1
#define false 0typedef unsigned int bool;size_t readData(void *ptr, size_t size, size_t nmemb, void *stream)
{char buf[10240] = {'\0'};strncpy(buf, ptr ,10240);printf("===================================get Data=====================\n");printf("%s\n",buf);
}bool postUrl()
{CURL *curl;CURLcode res;char *postString=NULL;char *img1[12];char *img2[12];char *key = "7AVtT3g3TRKnMPXGkNALGA";char *secret = "3d2252223b274c429d99ac7a5b5b6482";int typeId = 21;char *format = "xml";system("base64 1.jpg > photo3"); //将base64生成的文件信息导到photo3文件中来int fd = open("./photo3",O_RDWR);//打开photo3文件int filelen = lseek(fd, 0, SEEK_END);lseek(fd, 0, SEEK_SET); //计算文件都大小char *bufpic1 = (char *)malloc(filelen + 2);memset(bufpic1, 0, filelen+2);read(fd, bufpic1, filelen);//从文件中读取出来close(fd);system("base64 2.jpg > photo4");fd = open("./photo4",O_RDWR);filelen = lseek(fd, 0, SEEK_END);lseek(fd, 0, SEEK_SET);char *bufpic2 = (char *)malloc(filelen + 2);memset(bufpic2, 0, filelen+2);read(fd, bufpic2, filelen);close(fd);int len = strlen(key) + strlen(secret) + strlen(bufpic1) + strlen(bufpic2) + 124;//计算拼接的字符总长度postString = (char *)malloc(len);memset(postString , '\0', len);sprintf(postString,"&img1=%s&img2=%s&key=%s&secret=%s&typeId=%d&format=%s",bufpic1,bufpic2,key,secret,21,format );curl = curl_easy_init();if (curl){curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookie.txt"); // 指定cookie文件curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postString); //指定post内容 curl_easy_setopt(curl, CURLOPT_URL, "https://netocr.com/api/faceliu.do"); //指定urlcurl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, readData); //将返回http头输出到fp指定的文件 res = curl_easy_perform(curl);printf("OK: %d\n",res);//将请求的结果打印出来curl_easy_cleanup(curl);}return true;
}int main(void)
{// getUrl("/tmp/get.html");postUrl();return 0;
}
运行结果:
linux(ubuntu)人脸图片识别配置与实现相关推荐
- 新买的8T sata 固态硬盘Linux ubuntu服务器不识别
环境 硬盘型号:三星 v-nand ssd 870QVO 8TB 服务器型号:4U服务器 Supermicro主板 Ubuntu 18.04.5 LTS bionic 现象 服务器开机情况下,插在 服 ...
- Linux(Ubuntu)/Windows如何下载配置Chromedriver
Chromedirver国内资源下载 http://chromedriver.storage.googleapis.com/index.html http://npm.taobao.org/mirro ...
- Linux/Ubuntu 安装与单机配置hadoop
文章目录 1. 安装 2. 配置 步骤一:配置JAVA_HOME 步骤二:配置端口与文件格式 步骤三:配置HDFS文件目录 步骤四:配置mapred 步骤五:配置yarn 步骤六:格式化 步骤七:启动 ...
- AR增强图像——Vuforia图片识别配置以及使用
开发环境: Unity:2021.1.14flc1 Vuforia Engine AR:9.8.8 步骤: 1.Vuforia注册 首先需要在Vuforia官网进行注册登入,这样才可以使用官网中的许可 ...
- Linux - Ubuntu 18.04 网络配置(YAML)
文章目录 背景 YAML 注意事项 数据类型 对象 数组 纯量 复合结构 引用 严格类型 静态IP 动态IP 配置生效 查看ip 参考鸣谢 背景 Ubuntu 18.04 不再使用 ifupdown ...
- Linux要学git吗,git学习一 基于linux ubuntu git安装与配置
1.安装git ># sudo apt-get build-dep git-core git-doc 这个会安装git-core和git-doc依赖的库. 接下来去官网下载git的源码包.把下载 ...
- ubuntu nfs linux,Ubuntu的NFS功能配置
环境:Ubuntu 10.04 步骤: 1.sudo apt-get install portmap 2.sudo apt-get install nfs-kernel-server 注意:第2步我安 ...
- Linux Ubuntu查看主要硬件配置,GPU压力测试
查看机器SN号 $ sudo dmidecode -t 1 查看服务器型号和主板型号: $ sudo dmidecode |grep -A16 "System Information$&qu ...
- Python人脸微笑识别2-----Ubuntu16.04基于Tensorflow卷积神经网络模型训练的Python3+Dlib+Opencv实现摄像头人脸微笑检测
Python人脸微笑识别2--卷积神经网络进行模型训练目录 一.微笑数据集下载 1.微笑数据集下载 2.创建人脸微笑识别项目 3.数据集上传至Ubuntu人脸微笑识别项目文件夹 二.Python代码实 ...
最新文章
- python海龟画笔如何运行_Python海龟绘图:turtle的简单使用
- shell编程:实现shell字符串连接功能
- android.os.NetworkOnMainThreadException异常
- 观察者模式在个人网站邮件发布与订阅中的实践
- 快速上手,使用 Kotlin 把支付宝小程序装进自己的 App
- Kendo UI 模板概述
- python数学符号表示方法_用Python学数学之Sympy代数符号运算
- CSDM发布文章“请勿使用默认标题”
- [译]关于Android图形系统一些事实真相
- Android AES加密解密 CTR 模式
- Codeforces Round #101 (Div. 2)
- STM32项目总结--物联网毕设使用
- 第四十天 阿乐在其中—Android小游戏的飞机(四)加入敌人
- 武汉有哪些大学 计算机专业比较强,武汉有哪些计算机好的大学排名
- 【案例28】银行对账单管理-在线下载优化记录
- MicroLib微库和ARM标准C库有什么区别?
- 五百年春光明媚之重建亚历山大图书馆谭
- 二极管反向恢复时间和反向恢复电流
- 来聊聊云计算能否彻底改变业务和软件架构
- java+selenium+chromedriver 整页截屏
热门文章
- 配置web服务器证书,配置第三方CVP的Webservices Web服务器证书
- 2019年钎焊作业安全生产模拟考试题库及答案
- 达内学php,php开发要学习什么?达内php开发课程的6大阶段
- CF MySQL Service BOSH部署
- 两种主流软件测试方法
- 盖伦和瑞文对打的小游戏
- 365日历:信息与社区化的新模式
- Flutter 中的常见的按钮组件 以及自 定义按钮组件、FloatingActionButton 实现类似 闲鱼 App 底部导航凸起按钮
- C++程序设计(三)—— 函数和函数模板
- html排版标记应用,04HTML排版标记.doc