提交 a495480d 编写于 作者: G gineshidalgo99

Python working with non-default OpenPose

上级 6d76f91a
......@@ -538,15 +538,21 @@ if (WIN32)
file(GLOB CAFFE_DLL "${CMAKE_SOURCE_DIR}/3rdparty/windows/caffe_cpu/bin/*.dll")
endif ()
# Caffe 3rd-party DLLs
file(GLOB OPENCV3PTY_DLL "${CMAKE_SOURCE_DIR}/3rdparty/windows/caffe3rdparty/lib/*.dll")
file(GLOB CAFFE_3RD_PARTY_DLL "${CMAKE_SOURCE_DIR}/3rdparty/windows/caffe3rdparty/lib/*.dll")
# OpenCV DLLs
file(GLOB OPENCV_DLL "${CMAKE_SOURCE_DIR}/3rdparty/windows/opencv/x64/vc14/bin/*.dll")
# GLUT DLLs
file(GLOB GLUT_DLL "${CMAKE_SOURCE_DIR}/3rdparty/windows/freeglut/bin/*.dll")
# Spinnaker DLLs and other files
file(GLOB SPINNAKER_DLL "${CMAKE_SOURCE_DIR}/3rdparty/windows/spinnaker/bin/*")
# Copy DLLs into same folder
set(BIN_FOLDER ${CMAKE_BINARY_DIR}/bin)
file(MAKE_DIRECTORY ${BIN_FOLDER})
file(COPY ${CAFFE_DLL} DESTINATION ${BIN_FOLDER})
file(COPY ${OPENCV_DLL} DESTINATION ${BIN_FOLDER})
file(COPY ${OPENCV3PTY_DLL} DESTINATION ${BIN_FOLDER})
file(COPY ${CAFFE_3RD_PARTY_DLL} DESTINATION ${BIN_FOLDER})
file(COPY ${GLUT_DLL} DESTINATION ${BIN_FOLDER})
file(COPY ${SPINNAKER_DLL} DESTINATION ${BIN_FOLDER})
endif (BUILD_BIN_FOLDER)
endif (WIN32)
......
OpenPose Python Module
OpenPose Python Module and Demo
=============================================
## Contents
1. [Introduction](#introduction)
2. [Installation](#installation)
3. [Compatibility](#compatibility)
2. [Compatibility](#compatibility)
3. [Installation](#installation)
4. [Testing](#testing)
5. [Exporting Python OpenPose](#exporting-python-openpose)
## Introduction
......@@ -13,12 +15,15 @@ This experimental module exposes a Python API for OpenPose. This allows you to c
At present the Python API only supports body pose. Hands and Face will be added in the future.
## Installation
Check [doc/installation.md#python-module](./installation.md#python-module) for installation steps.
To simply test the OpenPose API in your project without installation, ensure that the line `sys.path.append('{OpenPose_path}/python')` is set in your `*.py` files, where `{OpenPose_path}` points to your build folder of OpenPose. Take a look at `build/examples/tutorial_pose/1_extract_pose.py` for an example.
On an Ubuntu or OSX based system, you may use it globally. Running `sudo make install` will install OpenPose by default into `/usr/local/python`. You can set this into your python path and start using it at any location.
## Compatibility
The OpenPose Python module is compatible with both Python 2 and Python 3. In addition, it will also run in all OpenPose compatible operating systems.
## Installation
Check [doc/installation.md#python-module](./installation.md#python-module) for installation steps.
The Python API requires Numpy for array management, and OpenCV for image loading. They can be installed via:
......@@ -27,9 +32,6 @@ pip install numpy
pip install opencv-python
```
## Compatibility
The OpenPose Python module is compatible with both Python 2 and Python 3. In addition, it will also run in all OpenPose compatible operating systems.
## Testing
......@@ -46,5 +48,8 @@ python 1_extract_pose.py
## Code Sample
See [examples/tutorial_python/1_extract_pose.py](../../../master/examples/tutorial_python/1_extract_pose.py).
## Exporting Python OpenPose
Note: This step is only required if you are moving the `*.py` files outside their original location, or writting new `*.py` scripts outside `build/examples/tutorial_python`.
- Option a, installing OpenPose: On an Ubuntu or OSX based system, you could install OpenPose by running `sudo make install`, you could then set the OpenPose path in your python scripts to the OpenPose installation path (default: `/usr/local/python`) and start using OpenPose at any location. Take a look at `build/examples/tutorial_pose/1_extract_pose.py` for an example.
- Option b, not Installing OpenPose: To move the OpenPose Python API demos to a different folder, ensure that the line `sys.path.append('{OpenPose_path}/python')` is properly set in your `*.py` files, where `{OpenPose_path}` points to your build folder of OpenPose. Take a look at `build/examples/tutorial_pose/1_extract_pose.py` for an example.
......@@ -15,7 +15,10 @@ else: sys.path.append('../../python');
# sys.path.append('/usr/local/python')
# Parameters for OpenPose. Take a look at C++ OpenPose example for meaning of components. Ensure all below are filled
from openpose import *
try:
from openpose import *
except:
raise Exception('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
params = dict()
params["logging_level"] = 3
params["output_resolution"] = "-1x-1"
......
......@@ -17,7 +17,10 @@ import time
dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append('../../python')
dir_path + "/../../models/"
from openpose import OpenPose
try:
from openpose import OpenPose
except:
raise Exception('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
# Params for change
defRes = 736
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册