import numpy as np import cv2 import sys, os, time import numpy as np import simplejson import sys, os import csv CURR_PATH = os.path.dirname(os.path.abspath(__file__)) + "/" sys.path.append(CURR_PATH + "../") from mylib.funcs import get_filenames CURR_PATH = os.path.dirname(os.path.abspath(__file__)) + "/" if 1: image_folder = CURR_PATH + '../skeleton_data/skeletons5apple_images/' video_name = CURR_PATH + '../mytest.avi' fnames = get_filenames(image_folder) N = len(fnames) image_start = 3 image_end = 200 framerate = 10 FASTER_RATE = 1 # Read image and save to video' fourcc = cv2.VideoWriter_fourcc(*'XVID') cnt = 0 for i in range(image_start, image_end + 1): cnt += 1 fname = "{:05d}.png".format(i) frame = cv2.imread(image_folder + fname) if cnt == 1: width = frame.shape[1]
def __init__(self, folder, num_skip=0): self.cnt_image = 0 self.folder = folder self.filenames = myfunc.get_filenames(folder, sort=True) self.idx_step = num_skip + 1 self.num_images = int(len(self.filenames) / self.idx_step)
import csv CURR_PATH = os.path.dirname(os.path.abspath(__file__))+"/" sys.path.append(CURR_PATH+"../") from mylib.io import load_skeletons from mylib.funcs import get_filenames CURR_PATH = os.path.dirname(os.path.abspath(__file__))+"/" if __name__=="__main__": # Parameters ------------------------------------------- data_idx = "5" read_from = "../skeleton_data/skeletons"+data_idx+"/" output_to = "../skeleton_data/skeletons"+data_idx+"_info.txt" NUM_SKELETONS = len(get_filenames(CURR_PATH + read_from)) # Main ------------------------------------------- int2str = lambda num, blank: ("{:0"+str(blank)+"d}").format(num) all_skeletons = [] all_skeletons_good_only = [] for i in range(1, NUM_SKELETONS+1): if i%100==0: print("{}/{}".format(i, NUM_SKELETONS)) skeletons = load_skeletons(CURR_PATH + read_from + int2str(i, 5) + ".txt") idx_person = 0 # Only one person in each image skeleton = skeletons[idx_person] # -- Push to result list all_skeletons.append(skeleton)