最近在实验楼看到这个课程,觉得很有意思,所以打算自己试一下,并且记录过程。用到系统是windows,python3.6版本。
这个项目是将第二张图片中的鼻子,眼睛,嘴巴裁剪下来,粘到第一张图片的相应位置,并且调整肤色,使得图片更加自然。
matthewearl.github.io/2015/07/28/switching-eds-with-python/
这次实验要用到的库有:dlib,openCV,docopt
首先要安装dlib库:
windows下安装dlib需要CMake, 需要一个C++编译器(g++, VS 都可以), 需要boost库,并且需要在环境变量path中添加这些东西。
www.cnblogs.com/syqlp/p/6137380.html
上面是网上找的安装教程。
首先去下载boost,下载下来,解压。
因为需要用到C++的编译器,所以在这里我们使用VS2013,这个我本来就有,所以安装就不在这里说了。首先看环境变量:我的电脑(右击)->属性->高级系统设置->环境变量,在系统环境变量里面找到下图这个:

然后根据上面的路径,在tools文件夹里面找到开发人员命令提示符

打开之后,使用cd命令将位置切换到刚才解压的boost文件夹中,然后输入:bootstrap.bat
运行,没有报错,然后根据提示输入: .\b2 运行,大概10分钟,最后显示成功。
这时候如果安装plib的话,它会提示没有cmake,所以我们要安装cmake

从官网上下载,然后安装,记住选择自动添加路径到环境变量。
安装cmake之后,我们还要连接boost

因为我的电脑是64位的,所以命令为:
b2 -a --with-python address-model=64 toolset=msvc runtime-link=static
最后显示

然后在dlib
文件夹中打开命令行,输入:python setup.py install
然而,我的报错了

扎心了,暂时还不知道怎么办。先放一下,我研究研究,接着装其他的库。
先安装docopt库,这个很简单 pip3 install docopt

然后开始安装openCV库。
先去下载相应的版本
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
因为我电脑是64位的,python的版本是3.6,所以,选择下载


还找了另外一个方法
jingyan.baidu.com/article/2a138328497ce6074b134f64.html

过程很混乱,不知道是哪个起了作用。反正最后能用了。

网友评论