Unverified Commit 436b3fc3 authored by tilman's avatar tilman
Browse files

add some output examples

parent 3d85f496
...@@ -11,6 +11,12 @@ from lib.triangles import * ...@@ -11,6 +11,12 @@ from lib.triangles import *
from lib.bisection import * from lib.bisection import *
from lib.misc import * from lib.misc import *
SHOW_WINDOW = False
SAVE_FILE = True
OUT_DIR = 'images/out/images_imdahl/main_structure_skelletons/'
#IN_DIR = "images/first_email/" # images from first email
IN_DIR = "images/images_imdahl/" # images from imdahl
params = dict() params = dict()
#params["model_folder"] = "/Users/Tilman/Documents/Programme/Python/forschungspraktikum/openpose/models/" #params["model_folder"] = "/Users/Tilman/Documents/Programme/Python/forschungspraktikum/openpose/models/"
params["model_folder"] = os.environ['OPENPOSE_MODELS'] params["model_folder"] = os.environ['OPENPOSE_MODELS']
...@@ -20,26 +26,25 @@ opWrapper = op.WrapperPython() ...@@ -20,26 +26,25 @@ opWrapper = op.WrapperPython()
opWrapper.configure(params) opWrapper.configure(params)
opWrapper.start() opWrapper.start()
#images_path = "images/first_email/" # images from first email
images_path = "images/images_imdahl/" # images from imdahl
images = os.listdir(images_path) images = [os.path.join(os.getcwd(), IN_DIR, f) for f in os.listdir(IN_DIR)] #make path absolute so os.chdir has no side effects
os.chdir(OUT_DIR) #save images in this dir
for img_name in images: for img_name in images:
# Process Image # Process Image
print("calculating: "+img_name) print("calculating: "+img_name)
datum = op.Datum() datum = op.Datum()
img = cv2.imread(images_path+img_name) img = cv2.imread(img_name)
datum.cvInputData = img datum.cvInputData = img
opWrapper.emplaceAndPop([datum]) opWrapper.emplaceAndPop([datum])
# img = datum.cvOutputData img = datum.cvOutputData
#print("poses:"+str(len(datum.poseKeypoints))) #print("poses:"+str(len(datum.poseKeypoints)))
triangles = [poseToTriangle(pose) for pose in datum.poseKeypoints] triangles = [poseToTriangle(pose) for pose in datum.poseKeypoints]
bisecVectors= [poseToBisectVector(pose) for pose in datum.poseKeypoints] bisecVectors= [poseToBisectVector(pose) for pose in datum.poseKeypoints]
cv2.namedWindow(img_name, cv2.WINDOW_NORMAL)
#paint triangles #paint triangles
for triangle in triangles: for triangle in triangles:
if triangle is not None: if triangle is not None:
...@@ -48,7 +53,12 @@ for img_name in images: ...@@ -48,7 +53,12 @@ for img_name in images:
if bisecVector is not None: if bisecVector is not None:
cv2.arrowedLine(img, trp(bisecVector[1]), trp(bisecVector[0]), (0,0,255), 2); cv2.arrowedLine(img, trp(bisecVector[1]), trp(bisecVector[0]), (0,0,255), 2);
cv2.imshow(img_name, img) if SAVE_FILE:
cv2.waitKey(0) cv2.imwrite(os.path.basename(img_name),img)
cv2.waitKey(0) if SHOW_WINDOW:
cv2.destroyAllWindows() cv2.namedWindow(img_name, cv2.WINDOW_NORMAL)
\ No newline at end of file cv2.imshow(img_name, img)
cv2.waitKey(0)
if SHOW_WINDOW:
cv2.waitKey(0)
cv2.destroyAllWindows()
\ No newline at end of file
images/images_imdahl/Kindermord.jpg

665 KB | W: | H:

images/images_imdahl/Kindermord.jpg

1.15 MB | W: | H:

images/images_imdahl/Kindermord.jpg
images/images_imdahl/Kindermord.jpg
images/images_imdahl/Kindermord.jpg
images/images_imdahl/Kindermord.jpg
  • 2-up
  • Swipe
  • Onion skin
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