Unverified Commit 7b201427 authored by tilman's avatar tilman
Browse files

restructure repo

parents
export OPENPOSE_MODELS="/Users/Tilman/Documents/Programme/Python/forschungspraktikum/openpose/models/"
export PYTHONPATH="/Users/Tilman/Documents/Programme/Python/forschungspraktikum/openpose/build/python:$PYTHONPATH"
\ No newline at end of file
## Installation
* tested with `Python 3.7.5`, `pip 19.3.1` and
* Install and build OpenPose (including OpenCV), for details see [official instructions](https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md#installation)
* make sure to append the openpose python bindings to your python path: `export PYTHONPATH=/path/to/openpose/build/python:$PYTHONPATH` !Important!: replace `/path/to/openpose` with your own path to your local openpose instalation
* set env var export OPENPOSE_MODELS="/path/to/openpose/models/"
* install all python dependencies: 'pip install'
## Usage
* make sure you have set all env vars
* start the main script: `python detect_structures.py`
\ No newline at end of file
# From Python
import sys
import cv2
import numpy as np
import os
from sys import platform
#sys.path.append('/Users/Tilman/Documents/Programme/Python/forschungspraktikum/openpose/python');
from openpose import pyopenpose as op
from lib.triangles import *
from lib.bisection import *
from lib.misc import *
params = dict()
#params["model_folder"] = "/Users/Tilman/Documents/Programme/Python/forschungspraktikum/openpose/models/"
params["model_folder"] = os.environ['OPENPOSE_MODELS']
# Starting OpenPose
opWrapper = op.WrapperPython()
opWrapper.configure(params)
opWrapper.start()
# images from first email
#images = ["28165_gw.jpg", "38172_gw.jpg", "92981_gw.jpg", "page_5_item_17_annunci1.jpg", "page_19_item_5_08religi.jpg"]
#images_path = "images/first_email/"
# images from imdahl
images = ["658px-Giotto_di_Bondone_-_No._3_Scenes_from_the_Life_of_Joachim_-_3._Annunciation_to_St_Anne_-_WGA09171.jpg","Ankunft_bei_den_Hirten.jpg","Beweinung.jpg","Darbringung_im_Tempel.jpg","Franziskus-Giotto1.jpg","Franziskus_Lossagung_vom_Vater.jpg","Fusswaschung.jpg","Giotto+-+Ambrogio+Bondone+-+Scrovegni+-+[10]+-+Prayer+of+the+Suitors+.jpeg","Giotto-Di-Bondone-Flight-into-Egypt-2-.jpeg","Giotto_-_Scrovegni_-_-06-_-_Meeting_at_the_Golden_Gate.jpg","Giotto_di_Bondone_-_Joachims_Dream_-_Capella_degli_Scrovegni.jpg","Giotto_di_Bondone_-_No._11_Scenes_from_the_Life_of_the_Virgin_-_5._Marriage_of_the_Virgin_-_WGA09183.jpg","Giotto_di_Bondone_-_No._4_Scenes_from_the_Life_of_Joachim_-_4._Joachim's_Sacrificial_Offering_-_WGA09173.jpg","Giotto_di_Bondone_-_No._9_Scenes_from_the_Life_of_the_Virgin_-_3._The_Bringing_of_the_Rods_to_the_Temple_-_WGA09181.jpg","HochzeitzuKanan.jpg","Judas_und_Christus.jpg","Kindermord.jpg","Verstoßung_Joachims_aus_Tempel.jpg","flucht-nach-aegypten.jpg"]
images_path = "images/images_imdahl/"
for img_name in images:
# Process Image
print("calculating: "+img_name)
datum = op.Datum()
img = cv2.imread(images_path+img_name)
datum.cvInputData = img
opWrapper.emplaceAndPop([datum])
# img = datum.cvOutputData
#print("poses:"+str(len(datum.poseKeypoints)))
triangles = [poseToTriangle(pose) for pose in datum.poseKeypoints]
bisecVectors= [poseToBisectVector(pose) for pose in datum.poseKeypoints]
cv2.namedWindow(img_name, cv2.WINDOW_NORMAL)
#paint triangles
for triangle in triangles:
if triangle is not None:
cv2.drawContours(img, [triangle], 0, 255, -1)
for bisecVector in bisecVectors:
if bisecVector is not None:
cv2.arrowedLine(img, trp(bisecVector[1]), trp(bisecVector[0]), (0,0,255), 2);
cv2.imshow(img_name, img)
cv2.waitKey(0)
cv2.waitKey(0)
cv2.destroyAllWindows()
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment