コード例 #1
0
import csv
import glob
import json
import math
import numpy
import os.path
from scipy.optimize import curve_fit

from Utils import getJsonData

import Image, ImageDraw

normalized = getJsonData("../data/results/normalized.json")

imgsize = 500
img = Image.new("RGB", (imgsize, imgsize), "black")
draw = ImageDraw.Draw(img)

for frame in normalized["frames"]:
	# show a single frame
	if frame["animationPercent"] < 1:
		continue

	for vertex in frame["vertices"]:
		color = "blue"
		if vertex["name"] == "knee-front":
			color = "green"
		if vertex["name"] == "foot-front":
			color = "yellow"
		if vertex["name"] == "waist":
			color = "red"
コード例 #2
0
		}

		for vidx in range(len(frame1["vertices"])):
			newf["vertices"].append(copy.deepcopy(frame1["vertices"][vidx]))
			for coordinate in ["x", "y"]:
				meanValue = None
				if frame1["vertices"][vidx][coordinate] != None:
					meanValue = numpy.mean([frame1["vertices"][vidx][coordinate], frame2["vertices"][vidx][coordinate]])

				newf["vertices"][vidx][coordinate] = meanValue

		newFrames.append(newf)

	frames.extend(newFrames)

initialData = getJsonData(files[0])
finalData = {"vertices" : initialData["vertices"], "lines" : initialData["lines"], "frames" : []}

minStepWidth = 10000
maxStepWidth = 0

for filename in files:
	data = getJsonData(filename)

	fileProperties = properties[os.path.basename(os.path.splitext(filename)[0])]

	normalizeAnimation(data, fileProperties)
	if allowInterpolatedData: addInterpolatedData(data)

	minStepWidth = min(data["stepWidth"], minStepWidth)
	maxStepWidth = max(data["stepWidth"], maxStepWidth)