Я пишу аддон Blender для работы с 3D-сканерами лица. Я хочу найти ориентиры (брови, уголки глаз, линия рта и т. Д. c) на изображении отсканированного лица, чтобы сопоставить их с моделью. Библиотека Dlib идеально подходит для поиска этих ориентиров, но я не смог установить ее в Python Blender'а (так что я могу вызвать его из аддона).
У меня не было проблем с установкой Dlib в автономном режиме Python (3.6.4) версия, которую я также установил. В качестве обходного пути в настоящее время я вызываю Python из подпроцесса в аддоне, но это очень медленно и затрудняет установку аддона на другом компьютере.
Вот вывод, когда я пытаюсь установить Dlib с pip в Blender's Python (Blender версии 2.81 с Python 3.7.4):
C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\bin> ./python -m pip install dlib --user
Collecting dlib
Using cached dlib-19.19.0.tar.gz (3.2 MB)
Installing collected packages: dlib
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\bin\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\David\AppData\Local\Temp\pip-record-k5d8lob9\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\David\AppData\Roaming\Python\Python37\Include\dlib'
cwd: C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\
Complete output (66 lines):
running install
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.7.4 (default, Aug 13 2019, 14:10:15) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\bin\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\build\lib.win-amd64-3.7 -A x64'
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
-- The C compiler identification is MSVC 19.16.27030.1
-- The CXX compiler identification is MSVC 19.16.27030.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: C:/Program Files/Blender Foundation/Blender 2.81/2.81/python/bin/python.exe (found version "3.7.4")
CMake Error at C:/Users/David/AppData/Local/Temp/pip-install-x18bl7c_/dlib/dlib/external/pybind11/tools/FindPythonLibsNew.cmake:158 (message):
Python libraries not found
Call Stack (most recent call first):
C:/Users/David/AppData/Local/Temp/pip-install-x18bl7c_/dlib/dlib/external/pybind11/tools/pybind11Tools.cmake:16 (find_package)
C:/Users/David/AppData/Local/Temp/pip-install-x18bl7c_/dlib/dlib/external/pybind11/CMakeLists.txt:33 (include)
-- Configuring incomplete, errors occurred!
See also "C:/Users/David/AppData/Local/Temp/pip-install-x18bl7c_/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\\Program Files\\Blender Foundation\\Blender 2.81\\2.81\\python\\bin\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\bin\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\David\AppData\Local\Temp\pip-record-k5d8lob9\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\David\AppData\Roaming\Python\Python37\Include\dlib' Check the logs for full command output.
Хотя я хотел бы использовать Dlib в Blender, я открыт для других методов поиска лицевые ориентиры на изображении. В любом случае мне нужен другой пользователь аддона (или сам аддон), чтобы иметь возможность устанавливать необходимые библиотеки без особой работы.
В случае, если это полезно, здесь видео демонстрация использования Dlib в Blender.
Пожалуйста, дайте мне знать, если я смогу что-то прояснить.
Спасибо, Дэвид