资源简介
使用python语言将3DMM人脸模型与人脸图片的进行拟合与匹配。
代码片段和文件信息
# -*- coding: utf-8 -*-
“““
Created on Sun Mar 25 10:20:07 2018
@author: For_Gondor
“““
import os
def search(content: str suffix: str = ‘‘ path: str = os.getcwd()):
“““
Find content in multiple files.
The results will be printed in the console.
Args:
content: string that you want to find.
suffix: files‘ suffix could be empty.
path: all files in the path will be searched (including files in subdirectories).
“““
list_root = []
list_root1 = []
list_dirs = []
list_files = []
for root dirs files in os.walk(path):
list_root.append(root)
list_dirs.append(dirs)
list_files.append(files)
list_root1.append(‘‘)
for i in range(1 len(list_root)):
list_root1.append(list_root[i].replace(list_root[0] + ‘\\‘ ‘‘))
for x in range(len(list_files)):
if not list_files[x]:
continue
for file in list_files[x]:
if suffix and not file.endswith(suffix):
continue
f = open(os.path.join(list_root[x] file) ‘rb‘)
lines = f.readlines()
f.close()
for i in range(len(lines)):
line = lines[i].decode(‘UTF-8‘ ‘ignore‘)
if content in line:
print(‘File “‘ + os.path.join(list_root1[x] file) +
‘“ contents “{}“ in line {}.‘.format(content i + 1))
print(‘\t‘ + line.strip())
print()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-08-02 08:33 3DMM-fitting-master\
文件 66 2018-08-02 08:33 3DMM-fitting-master\.gitattributes
文件 1977 2018-08-02 08:33 3DMM-fitting-master\README.md
目录 0 2018-08-02 08:33 3DMM-fitting-master\assist\
文件 0 2018-08-02 08:33 3DMM-fitting-master\assist\__init__.py
文件 1519 2018-08-02 08:33 3DMM-fitting-master\assist\content_search.py
文件 810 2018-08-02 08:33 3DMM-fitting-master\assist\get_adj_dict.py
文件 10645 2018-08-02 08:33 3DMM-fitting-master\assist\marker.py
文件 2331 2018-08-02 08:33 3DMM-fitting-master\assist\model_transfer.py
文件 1224 2018-08-02 08:33 3DMM-fitting-master\assist\search.ipynb
目录 0 2018-08-02 08:33 3DMM-fitting-master\core\
文件 2196 2018-08-02 08:33 3DMM-fitting-master\core\Blendshape.py
文件 2130 2018-08-02 08:33 3DMM-fitting-master\core\EdgeTopology.py
文件 1854 2018-08-02 08:33 3DMM-fitting-master\core\Landmark.py
文件 2437 2018-08-02 08:33 3DMM-fitting-master\core\LandmarkMapper.py
文件 2172 2018-08-02 08:33 3DMM-fitting-master\core\Mesh.py
文件 3572 2018-08-02 08:33 3DMM-fitting-master\core\MorphableModel.py
文件 5194 2018-08-02 08:33 3DMM-fitting-master\core\PcaModel.py
文件 7100 2018-08-02 08:33 3DMM-fitting-master\core\RenderingParameters.py
文件 0 2018-08-02 08:33 3DMM-fitting-master\core\__init__.py
文件 7138 2018-08-02 08:33 3DMM-fitting-master\core\blendshape_fitting.py
文件 14966 2018-08-02 08:33 3DMM-fitting-master\core\closest_edge_fitting.py
文件 12696 2018-08-02 08:33 3DMM-fitting-master\core\contour_correspondence.py
文件 56756 2018-08-02 08:33 3DMM-fitting-master\core\fitting.py
文件 5418 2018-08-02 08:33 3DMM-fitting-master\core\glm.py
文件 13594 2018-08-02 08:33 3DMM-fitting-master\core\linear_shape_fitting.py
文件 3998 2018-08-02 08:33 3DMM-fitting-master\core\orthographic_camera_estimation_linear.py
文件 37681 2018-08-02 08:33 3DMM-fitting-master\core\render.py
文件 2720 2018-08-02 08:33 3DMM-fitting-master\core\utils.py
目录 0 2018-08-02 08:33 3DMM-fitting-master\data\
文件 1103 2018-08-02 08:33 3DMM-fitting-master\data\00019fa010_940128.pts
............此处省略25个文件信息
评论
共有 条评论