虹软SDk中引入tinyhttpd

下载tinyhttpd 代码

在泰山派的sdk里面,查看tinyhttpd的mk文件

TINYHTTPD_VERSION = 0.1.0
TINYHTTPD_SITE = http://downloads.sourceforge.net/project/tinyhttpd/tinyhttpd%20source/tinyhttpd%20$(TINYHTTPD_VERSION)

对代码进行下载

$ mkdir ./tinyhttpd
$ cd ./tinyhttpd/
tinyhttpd$ wget http://downloads.sourceforge.net/project/tinyhttpd/tinyhttpd%20source/tinyhttpd%200.1.0/tinyhttpd-0.1.0.tar.gz
--2024-09-16 14:44:53--  http://downloads.sourceforge.net/project/tinyhttpd/tinyhttpd%20source/tinyhttpd%200.1.0/tinyhttpd-0.1.0.tar.gz
Resolving downloads.sourceforge.net (downloads.sourceforge.net)... 204.68.111.105
Connecting to downloads.sourceforge.net (downloads.sourceforge.net)|204.68.111.105|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://jaist.dl.sourceforge.net/project/tinyhttpd/tinyhttpd%20source/tinyhttpd%200.1.0/tinyhttpd-0.1.0.tar.gz?viasf=1 [following]
--2024-09-16 14:44:53--  http://jaist.dl.sourceforge.net/project/tinyhttpd/tinyhttpd%20source/tinyhttpd%200.1.0/tinyhttpd-0.1.0.tar.gz?viasf=1
Resolving jaist.dl.sourceforge.net (jaist.dl.sourceforge.net)... 150.65.7.130, 2001:df0:2ed:feed::feed
Connecting to jaist.dl.sourceforge.net (jaist.dl.sourceforge.net)|150.65.7.130|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5934 (5.8K) [application/x-gzip]
Saving to: ‘tinyhttpd-0.1.0.tar.gz’

tinyhttpd-0.1.0.tar.gz        100%[===============================================>]   5.79K  --.-KB/s    in 0s

2024-09-16 14:44:53 (246 MB/s) - ‘tinyhttpd-0.1.0.tar.gz’ saved [5934/5934]

/tinyhttpd$ tar -zxvf ./tinyhttpd-0.1.0.tar.gz
tinyhttpd-0.1.0/
tinyhttpd-0.1.0/htdocs/
tinyhttpd-0.1.0/htdocs/check.cgi
tinyhttpd-0.1.0/htdocs/README
tinyhttpd-0.1.0/htdocs/color.cgi
tinyhttpd-0.1.0/htdocs/index.html
tinyhttpd-0.1.0/Makefile
tinyhttpd-0.1.0/README
tinyhttpd-0.1.0/httpd.c
tinyhttpd-0.1.0/simpleclient.c

tinyhttpd$ tree ./
./
├── tinyhttpd-0.1.0
│   ├── htdocs
│   │   ├── check.cgi
│   │   ├── color.cgi
│   │   ├── index.html
│   │   └── README
│   ├── httpd.c
│   ├── Makefile
│   ├── README
│   └── simpleclient.c
└── tinyhttpd-0.1.0.tar.gz

2 directories, 9 files

把其中的htdocs文件夹和httpd.c复制到虹软的SDK目录下

在主程序中引入httpd

httpd.c中,有一个注释要留意

/* This program compiles for Sparc Solaris 2.6.
 * To compile for Linux:
 *  1) Comment out the #include <pthread.h> line.
 *  2) Comment out the line that defines the variable newthread.
 *  3) Comment out the two lines that run pthread_create().
 *  4) Uncomment the line that runs accept_request().
 *  5) Remove -lsocket from the Makefile.
 */

按照要求操作,这样就不使用pthread_create多线程操作,只能处理一个请求
由于htdocs在上一层,也要修改一下这里

sprintf(path, "../htdocs%s", url);

把httpd的main函数改成 int httpd_main(void),并在主程序中调用

//tinyhttpd
httpd_main();

编译测试

在cmake文件中添加httpd.c和httpd.h, 编译,测试

face/samplecode/ASFTestDemo/build$ sudo ./arcsoft_face_engine_test
......
httpd running on port 39153

测试结果

进一步将httpd单独开线程固定端口

固定8080端口

u_short port = 8080;

更改原来的httpd函数为

void* httpd_thread(void* arg)

主函数调用

    //tinyhttpd
	pthread_t newthread;
	void* arg_httpd;
	if (pthread_create(&newthread , NULL, httpd_thread, arg_httpd) != 0)
        perror("pthread_create");

	printf("main thread ok \n");

编译测试

main thread ok
httpd running on port 8080

两个线程正常
固定8080端口

虹软SDK是一种人脸识别技术,它广泛应用于各种领域,包括安防监控、社交娱乐、金融支付等。在CSND上,可以找到丰富的关于虹软SDK人脸识别的技术文章和开发案例。 虹软SDK人脸识别技术具有高性能、高准确性和高稳定性的特点。它采用深度学习算法,通过对人脸进行特征分析和匹配,能够实现快速、精准地识别人脸。该技术还可以检测人脸的关键点,如眼睛、鼻子、嘴巴等,用于表情分析和人脸特征提取。 虹软SDK人脸识别还具有优良的适应能力。它能够在复杂的环境条件下进行准确的人脸检测和识别,识别效果不受光线、角度、年龄、肤色等因素的限制。同时,虹软SDK还支持多人同时识别,可以实现快速的批量人脸识别。 在CSND上,有许多文章介绍了如何使用虹软SDK实现人脸识别功能。这些文章详细介绍了虹软SDK的安装使用步骤、API接口的调用方法及其返回结果的解析。同时,还提供了许多开发案例和技术分享,包括人脸识别的图像处理方法、模型训练技巧和优化策略等。 在虹软SDK人脸识别的开发过程,CSND是一个宝贵的资源平台。开发者可以通过学习和参考这些文章和案例,快速掌握虹软SDK的使用方法,并且通过技术交流平台与其他开发者进行问题讨论和资源共享。这将有助于提高人脸识别系统的开发效率和质量,促进技术的快速应用和推广。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值