@@ -74,14 +74,14 @@ All the Python examples from the Tutorial API Python module can be found in `bui
cd build/examples/tutorial_api_python
# Python 3 (default version)
python3 1_body_from_image.py
python3 2_whole_body_from_image.py
# python3 [any_other_example.py]
python3 01_body_from_image.py
python3 02_whole_body_from_image.py
# python3 [any_other_python_example.py]
# Python 2
python2 1_body_from_image.py
python2 2_whole_body_from_image.py
# python2 [any_other_example.py]
python2 01_body_from_image.py
python2 02_whole_body_from_image.py
# python2 [any_other_python_example.py]
```
...
...
@@ -91,8 +91,8 @@ Note: This step is only required if you are moving the `*.py` files outside thei
Ubuntu/OSX:
- 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_api_python/1_body_from_image.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_api_python/1_body_from_image.py` for an example.
- 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_api_python/01_body_from_image.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_api_python/01_body_from_image.py` for an example.
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
raisee
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000192.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000192.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
params=dict()
params["model_folder"]="../../../models/"
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
raisee
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000241.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000241.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
params=dict()
params["model_folder"]="../../../models/"
params["face"]=True
params["hand"]=True
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
raisee
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_dir",default="../../../examples/media/",help="Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).")
parser.add_argument("--no_display",default=False,help="Enable to disable the visual display.")
args=parser.parse_known_args()
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_dir",default="../../../examples/media/",help="Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).")
parser.add_argument("--no_display",default=False,help="Enable to disable the visual display.")
args=parser.parse_known_args()
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
params=dict()
params["model_folder"]="../../../models/"
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
params=dict()
params["model_folder"]="../../../models/"
# Add others in path?
foriinrange(0,len(args[1])):
curr_item=args[1][i]
ifi!=len(args[1])-1:next_item=args[1][i+1]
else:next_item="1"
if"--"incurr_itemand"--"innext_item:
key=curr_item.replace('-','')
ifkeynotinparams:params[key]="1"
elif"--"incurr_itemand"--"notinnext_item:
key=curr_item.replace('-','')
ifkeynotinparams:params[key]=next_item
# Add others in path?
foriinrange(0,len(args[1])):
curr_item=args[1][i]
ifi!=len(args[1])-1:next_item=args[1][i+1]
else:next_item="1"
if"--"incurr_itemand"--"innext_item:
key=curr_item.replace('-','')
ifkeynotinparams:params[key]="1"
elif"--"incurr_itemand"--"notinnext_item:
key=curr_item.replace('-','')
ifkeynotinparams:params[key]=next_item
# Construct it from system arguments
# op.init_argv(args[1])
# oppython = op.OpenposePython()
# Construct it from system arguments
# op.init_argv(args[1])
# oppython = op.OpenposePython()
try:
# Starting OpenPose
opWrapper=op.WrapperPython()
opWrapper.configure(params)
...
...
@@ -79,5 +79,5 @@ try:
end=time.time()
print("OpenPose demo successfully finished. Total time: "+str(end-start)+" seconds")
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
raisee
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_dir",default="../../../examples/media/",help="Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).")
parser.add_argument("--no_display",default=False,help="Enable to disable the visual display.")
parser.add_argument("--num_gpu",default=op.get_gpu_number(),help="Number of GPUs.")
args=parser.parse_known_args()
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
raisee
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_dir",default="../../../examples/media/",help="Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).")
parser.add_argument("--no_display",default=False,help="Enable to disable the visual display.")
parser.add_argument("--num_gpu",default=op.get_gpu_number(),help="Number of GPUs.")
args=parser.parse_known_args()
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
params=dict()
params["model_folder"]="../../../models/"
params["num_gpu"]=int(vars(args[0])["num_gpu"])
numberGPUs=int(params["num_gpu"])
# Add others in path?
foriinrange(0,len(args[1])):
curr_item=args[1][i]
ifi!=len(args[1])-1:next_item=args[1][i+1]
else:next_item="1"
if"--"incurr_itemand"--"innext_item:
key=curr_item.replace('-','')
ifkeynotinparams:params[key]="1"
elif"--"incurr_itemand"--"notinnext_item:
key=curr_item.replace('-','')
ifkeynotinparams:params[key]=next_item
# Construct it from system arguments
# op.init_argv(args[1])
# oppython = op.OpenposePython()
try:
# Starting OpenPose
opWrapper=op.WrapperPython()
opWrapper.configure(params)
...
...
@@ -106,5 +106,5 @@ try:
end=time.time()
print("OpenPose demo successfully finished. Total time: "+str(end-start)+" seconds")
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
raisee
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000241.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000241.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
params=dict()
params["model_folder"]="../../../models/"
params["face"]=True
params["face_detector"]=2
params["body"]=0
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
raisee
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000241.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000241.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
params=dict()
params["model_folder"]="../../../models/"
params["hand"]=True
params["hand_detector"]=2
params["body"]=0
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
raisee
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000192.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000192.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
params=dict()
params["model_folder"]="../../../models/"
params["heatmaps_add_parts"]=True
params["heatmaps_add_bkg"]=True
params["heatmaps_add_PAFs"]=True
params["heatmaps_scale"]=2
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
raisee
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000294.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000294.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Load image
imageToProcess=cv2.imread(args[0].image_path)
# Load image
imageToProcess=cv2.imread(args[0].image_path)
defget_sample_heatmaps():
# These parameters are globally set. You need to unset variables set here if you have a new OpenPose object. See *
params=dict()
params["model_folder"]="../../../models/"
params["heatmaps_add_parts"]=True
params["heatmaps_add_bkg"]=True
params["heatmaps_add_PAFs"]=True
params["heatmaps_scale"]=3
params["upsampling_ratio"]=1
params["body"]=1
defget_sample_heatmaps():
# These parameters are globally set. You need to unset variables set here if you have a new OpenPose object. See *
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
# Change these variables to point to the correct folder (Release/x64 etc.)
sys.path.append('../../python');
# If you run `make install` (default path is `/usr/local/python` for Ubuntu), you can also access the OpenPose/python module from there. This will install OpenPose and the python library at your desired installation path. Ensure that this is in your python path in order to use it.
# sys.path.append('/usr/local/python')
fromopenposeimportpyopenposeasop
exceptImportErrorase:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
raisee
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000192.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Flags
parser=argparse.ArgumentParser()
parser.add_argument("--image_path",default="../../../examples/media/COCO_val2014_000000000192.jpg",help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args=parser.parse_known_args()
# Custom Params (refer to include/openpose/flags.hpp for more parameters)
params=dict()
params["model_folder"]="../../../models/"
# Custom Params (refer to include/openpose/flags.hpp for more parameters)