# 3D Face Reconstrction - Personal Project
I built this out of my personal interest back to 2018 when I was a senior undergraduate in Compute Science. The total time that i spent on this project was a week.
The main goal of the program is to reconstruct a 3D face model from a single front-face image with the help of C++, QT, OpenGL, OpenCV, eos/dlib libraries and surrey face modesl. it extracts face texture, constructs a face model in.obj format, and reconstructs the full 3D model.
The interactive UI was implemented using C++ Qt.
Following is a screenshot of the model viewer UI. You could adjust the model angles with sliders or drag with your mouse to adjust the pose of the model at east.
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/obj_model_viewer_2.jpeg"></img>
## Dependencies
I used Visual Studio 2018 on Windows to do my project.
* In order to compile the program, you need to configure the following dependencies in order:
OpenCV -> OpenGL -> dlib -> eos -> Qt
- you could find the following two files in dependencies folder:
- dlib_to_sfm.txt: mapping bettween dlib and sfm model
- expression_blendshapes_3448.bin: basic sfm model.
* Some useful links:
https://github.com/patrikhuber/eos
http://dlib.net
## The Surrey Face Model
I used a shape-only version of the Surrey Morphable Face Model as the skeleton of the model.
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/sfm_shape_3448_mesh.png" width=20% alt="Surrey Face Model shape picture"></img>
The full models with higher resolution are available at [http://www.cvssp.org/facemodel](http://www.cvssp.org/facemodel).
## Face Landmark Detection
Here is the face landmark detection part. By selecting 68 landmarks, a face could be identified and located in the image.
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/face_landmarks.jpeg"></img>
Given the input sample photo:
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/sample_4.png"></img>
By running face detection module, my program identified the front face and its outline and some interest points, e.g. nose and eyes.
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/obj_model_viewer_1.png"></img>
## Texture Extraction
By implementing the texture extraction API, combined with Dlib face landmark detection data, the texture can be extracted from the original image.
The face texture could be presented in this sturcture:
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/texture_mesh.png"></img>
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/texture_sample.png"></img>
## Face Reconstruction
Here comes the most challanging part.
* First, the program fits the original model to different face image, adjusts its surface parameters in order to present more natural and realistic outputs.
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/fitted_models_1.jpeg"></img>
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/fitted_models_2.jpeg"></img>
* Secondly, given an extracted texture of the face and the surrey face model, the program calculates a mapping between the coordinates from a 2D image to a 3D model.
Some final outputs:
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/models_with_texture.jpeg"></img>
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/sample_1.png"></img>
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/model_1.png"></img>
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/sample_2.png"></img>
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/model_2.png"></img>
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/sample_4.png"></img>
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/model_4.png"></img>
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/sample_3.png"></img>
<img src="https://github.com/JerryWu96/3D_Face_Reconstrction/blob/master/program%20screenshots/model_3.png"></img>
## Special Notice
You may have noticed that in Reconstruct.cpp, code that reads higher-resolution sfm model has been commented out, since these models are not publicly available, and i am not permitted to upload them here.
Back to 2019, the research team behind Surrey face model updated their models with new formats, as well as new python code to handle them, which i haven't looked into yet. My program uses a deprecated version which was updated in 2018. Please email them if you still want to get versions that are compatible with my program.
I have received more than 10 emails asking whether i will add support to the new Surrey face model. Note that currently I do not have the plan to use their new versions since it will add some extra overhead to the code, and i haven't found real benefits in doing so. Please understand that this is a project i spent a week working on, and refactoring could take efforts since i no longer have any Windows laptop with me.
However, i am happy to discuss with you the questions about the current code. It is up to you to decide if you would like to make it better:)
Please submit PRs if you decide to have a major update, thanks!
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于Qt+opencv+OpenGL实现根据图片进行3D人脸建模系统+详细文档说明,适合毕业设计、课程设计、项目开发。项目源码已经过严格测试,可以放心下载使用~ 基于Qt+opencv+OpenGL实现根据图片进行3D人脸建模系统+详细文档说明,适合毕业设计、课程设计、项目开发。项目源码已经过严格测试,可以放心下载使用~ 基于Qt+opencv+OpenGL实现根据图片进行3D人脸建模系统+详细文档说明,适合毕业设计、课程设计、项目开发。项目源码已经过严格测试,可以放心下载使用~ 项目简介: 该项目的主要目标是借助C++、QT、OpenGL、OpenCV、eos/dlib库和surrey face modes1从单个人脸图像重建三维人脸模型。提取人脸纹理,构建obj格式的人脸模型,重构完整的三维模型。 交互式UI是用C++Qt实现的。
资源推荐
资源详情
资源评论
收起资源包目录
基于Qt+opencv的3D人脸建模.zip (39个子文件)
3D_Face_Reconstrction-master
include
Model.h 900B
myglwidget.h 1014B
window.h 541B
ui_viewer.h 2KB
Functions.h 459B
viewer.h 734B
Qt
viewer.ui 530B
window.ui 5KB
dependencies
dlib_to_sfm.txt 3KB
expression_blendshapes_3448.bin 243KB
source
StringReplace.cpp 448B
delay.cpp 362B
FaceDetection.cpp 4KB
main.cpp 1KB
myglwidget.cpp 3KB
viewer.cpp 2KB
window.cpp 1KB
Reconstruct.cpp 8KB
Model.cpp 4KB
program screenshots
fitted_models_1.jpeg 103KB
texture_sample.png 308KB
sample_1.png 201KB
model_1.png 107KB
model_4.png 108KB
model_2.png 109KB
face_landmarks.jpeg 132KB
obj_model_viewer_2.jpeg 216KB
model_5.png 87KB
sfm_shape_3448_mesh.png 382KB
model_3.png 127KB
models_with_texture.jpeg 285KB
sample_4.png 213KB
texture_mesh.png 758KB
obj_model_viewer_1.png 628KB
fitted_models_2.jpeg 122KB
sample_3.png 223KB
sample_5.png 123KB
sample_2.png 208KB
README.md 6KB
共 39 条
- 1
资源评论
- hunter高2024-05-15感谢资源主的分享,这个资源对我来说很有用,内容描述详尽,值得借鉴。
- 向日葵xyz2024-07-03这个资源总结的也太全面了吧,内容详实,对我帮助很大。
梦回阑珊
- 粉丝: 5188
- 资源: 1681
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功