# 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("--camera_height",type=float,default=1.45,help="Set camera height")
args=parser.parse_known_args()
# 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
# Construct it from system arguments
# op.init_argv(args[1])
# oppython = op.OpenposePython()
cap=cv2.VideoCapture(1)
# Starting OpenPose
opWrapper=op.WrapperPython()
opWrapper.configure(params)
opWrapper.start()
frameId=0#todo delete then
time.sleep(10)
print("NOWWWWWWW")
print("NOWWWWWWWW")
whileTrue:
# Capture video frame from camera
ret,frame=cap.read()
coords=np.asarray([[0.,2.]])#TODO DELETE THEN
radar_data=from_2d_to_angles_euclid(coords)#TODO DELETE THEN
height,width,_=frame.shape#TODO DELETE THEN
datum=op.Datum()#TODO DELETE THEN
datum.cvInputData=frame#TODO DELETE THEN
opWrapper.emplaceAndPop(op.VectorDatum([datum]))#TODO DELET THEN
pixel_keypoints=np.round(datum.poseKeypoints[:,[0,1,5,6,7,2,3,4,12,13,14,9,10,11,8],:2])# todo remove
# todo uncomment pixel_keypoints = np.round(datum.poseKeypoints[:,[0,1,2,3,4,5,6,7,9,10,11,12,13,14,8],:2]) # convert tp descrete pixel coordinates while still maintaining double type
# datum.poseKeypoints shape = (N, 25, 3) where N=people detected by camera, 25=human body keypoints, 3=(x,y,score)
# pixel_keypoints shape = (N, 15, 2) where N=people detected by camera, 15=human body keypoints, 2=(x,y)
# replace not detected keypoints (they have 0 pixel coordinates) with nan
# no_occlusion_estimated_3D_coordinates shape = (T, 15, 3) where T= not occluded people detected by camera and radar, 15=human body keypoints, 3=(x,y,z)