Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript

Stable Stage 1 and 2 changes

Aaron Cheriancfd86f77b0b0
diff --git a/freemocap/initialization.py b/freemocap/initialization.py
index e005c6b1..812f2e34 100644
--- a/freemocap/initialization.py
+++ b/freemocap/initialization.py
@@ -67,8 +67,9 @@ def initialize(session, stage, board):
session.rotationInputs = rotation_input
#create a config yaml and text file for this session
- config_yaml_path = recordingconfig.createSession(session,filepath)
- recordingconfig.createSessionTxt(session,paramDict,rotDict)
+ session.start_session(session.parameterDictionary,session.rotationInputs)
+ #config_yaml_path = recordingconfig.createSession(session,filepath)
+ #recordingconfig.createSessionTxt(session,paramDict,rotDict)
print('Proceeding to Stage One')
diff --git a/freemocap/recordingconfig.py b/freemocap/recordingconfig.py
index bddfcbcc..d1692375 100644
--- a/freemocap/recordingconfig.py
+++ b/freemocap/recordingconfig.py
@@ -4,138 +4,141 @@ Created on Thu Mar 11 11:54:12 2021
@author: Rontc
"""
-from ruamel.yaml import YAML
-from pathlib import Path
-def createSession(session,filepath, existing_data = False):
- #create file paths for the session, raw and synced videos
+folder_setup = ['RawVideos','SyncedVideos','CalVideos','DataArrays','DLCData','OpenPoseData','MediaPipeData','imOut']
+
+
+
+
+# def createSession(session,filepath, existing_data = False):
+# #create file paths for the session, raw and synced videos
- pathList = []
+# pathList = []
- recordPath = filepath/'Data'
- recordPath.mkdir(exist_ok= True)
+# recordPath = filepath/'Data'
+# recordPath.mkdir(exist_ok= True)
- session.sessionPath = recordPath/session.sessionID
- #if existing_data:
- #session.sessionPath.mkdir(exist_ok = True)
- #else:
- session.sessionPath.mkdir(exist_ok= True)
- pathList.append(session.sessionPath)
+# session.sessionPath = recordPath/session.sessionID
+# #if existing_data:
+# #session.sessionPath.mkdir(exist_ok = True)
+# #else:
+# session.sessionPath.mkdir(exist_ok= True)
+# pathList.append(session.sessionPath)
- session.rawVidPath = session.sessionPath/'RawVideos'
- session.rawVidPath.mkdir(exist_ok = True)
- pathList.append(session.rawVidPath)
+# session.rawVidPath = session.sessionPath/'RawVideos'
+# session.rawVidPath.mkdir(exist_ok = True)
+# pathList.append(session.rawVidPath)
- session.syncedVidPath = session.sessionPath/'SyncedVideos'
- session.syncedVidPath.mkdir(exist_ok = True)
- pathList.append(session.syncedVidPath)
+# session.syncedVidPath = session.sessionPath/'SyncedVideos'
+# session.syncedVidPath.mkdir(exist_ok = True)
+# pathList.append(session.syncedVidPath)
- session.calVidPath = session.sessionPath/'CalVideos'
- session.calVidPath.mkdir(exist_ok = True)
- pathList.append(session.calVidPath)
+# session.calVidPath = session.sessionPath/'CalVideos'
+# session.calVidPath.mkdir(exist_ok = True)
+# pathList.append(session.calVidPath)
- session.openPoseDataPath = session.sessionPath/'OpenPoseData'
- session.openPoseDataPath.mkdir(exist_ok = True)
- pathList.append(session.openPoseDataPath)
+# session.openPoseDataPath = session.sessionPath/'OpenPoseData'
+# session.openPoseDataPath.mkdir(exist_ok = True)
+# pathList.append(session.openPoseDataPath)
- session.mediaPipeDataPath = session.sessionPath/'MediaPipeData'
- session.mediaPipeDataPath.mkdir(exist_ok = True)
- pathList.append(session.mediaPipeDataPath)
+# session.mediaPipeDataPath = session.sessionPath/'MediaPipeData'
+# session.mediaPipeDataPath.mkdir(exist_ok = True)
+# pathList.append(session.mediaPipeDataPath)
- session.dlcDataPath = session.sessionPath / 'DLCdata'
- session.dlcDataPath.mkdir(exist_ok = True, parents = True)
- pathList.append(session.dlcDataPath)
+# session.dlcDataPath = session.sessionPath / 'DLCdata'
+# session.dlcDataPath.mkdir(exist_ok = True, parents = True)
+# pathList.append(session.dlcDataPath)
- session.imOutPath = session.sessionPath / 'imOut'
- session.imOutPath.mkdir(exist_ok=True)
- pathList.append(session.imOutPath)
+# session.imOutPath = session.sessionPath / 'imOut'
+# session.imOutPath.mkdir(exist_ok=True)
+# pathList.append(session.imOutPath)
- session.dataArrayPath = session.sessionPath/'Data Arrays'
- session.dataArrayPath.mkdir(exist_ok=True)
- pathList.append(session.dataArrayPath)
+# session.dataArrayPath = session.sessionPath/'Data Arrays'
+# session.dataArrayPath.mkdir(exist_ok=True)
+# pathList.append(session.dataArrayPath)
- #create a list of paths that is passed to the recording script
- #pathList = [session.sessionPath,session.rawVidPath,session.syncedVidPath,session.openPoseDataPath,session.dlcDataPath,session.imOutPath, session.dataArrayPath]
+# #create a list of paths that is passed to the recording script
+# #pathList = [session.sessionPath,session.rawVidPath,session.syncedVidPath,session.openPoseDataPath,session.dlcDataPath,session.imOutPath, session.dataArrayPath]
- config_settings,config_yaml = create_config_yaml()
- session.config_settings = config_settings
+# config_settings,config_yaml = create_config_yaml()
+# session.config_settings = config_settings
- yaml_name = session.sessionPath/'{}_config.yaml'.format(session.sessionID)
- session.yamlPath = yaml_name
- # print(yaml_name)
- write_config_yaml(session,config_settings,config_yaml,pathList,yaml_name)
+# yaml_name = session.sessionPath/'{}_config.yaml'.format(session.sessionID)
+# session.yamlPath = yaml_name
+# # print(yaml_name)
+# write_config_yaml(session,config_settings,config_yaml,pathList,yaml_name)
- return yaml_name
-
-def createSessionTxt(session,paramDict,rotDict):
- #create a text file listing recording parameters
- parameter_text = session.sessionPath/'sessionSettings.txt'
- text = open(parameter_text, 'w')
- text.write("Session ID = %s\n" %(session.sessionID))
- text.write("%s = %s\n" %("Parameters", paramDict))
- text.write("%s = %s\n" %("Rotations", rotDict))
- text.close()
+# return yaml_name
+
+# def createSessionTxt(session,paramDict,rotDict):
+# #create a text file listing recording parameters
+# parameter_text = session.sessionPath/'sessionSettings.txt'
+# text = open(parameter_text, 'w')
+# text.write("Session ID = %s\n" %(session.sessionID))
+# text.write("%s = %s\n" %("Parameters", paramDict))
+# text.write("%s = %s\n" %("Rotations", rotDict))
+# text.close()
-def create_config_yaml():
+# def create_config_yaml():
- yaml_str = """\
- # Camera Inputs
- CamInputs:
- RotationInputs:
- ParameterDict:
+# yaml_str = """\
+# # Camera Inputs
+# CamInputs:
+# RotationInputs:
+# ParameterDict:
- # Paths
- Paths:
- sessionPath:
- rawVidPath:
- syncedVidPath:
- calVidPath:
- openPoseDataPath:
- mediaPipeDataPath:
- dlcDataPath:
- imOutPath:
- dataArrayPath:
- \n
- """
- config_yaml = YAML()
- config_settings = config_yaml.load(yaml_str)
+# # Paths
+# Paths:
+# sessionPath:
+# rawVidPath:
+# syncedVidPath:
+# calVidPath:
+# openPoseDataPath:
+# mediaPipeDataPath:
+# dlcDataPath:
+# imOutPath:
+# dataArrayPath:
+# \n
+# """
+# config_yaml = YAML()
+# config_settings = config_yaml.load(yaml_str)
- return config_settings,config_yaml
+# return config_settings,config_yaml
-def write_config_yaml(session,config_settings,config_yaml,pathList,yaml_name):
+# def write_config_yaml(session,config_settings,config_yaml,pathList,yaml_name):
- for count,key in enumerate(config_settings['Paths'].keys()):
- config_settings['Paths'][key] = str(pathList[count])
+# for count,key in enumerate(config_settings['Paths'].keys()):
+# config_settings['Paths'][key] = str(pathList[count])
- config_settings['CamInputs']['RotationInputs'] = session.rotationInputs
- config_settings['CamInputs']['ParameterDict'] = session.parameterDictionary
+# config_settings['CamInputs']['RotationInputs'] = session.rotationInputs
+# config_settings['CamInputs']['ParameterDict'] = session.parameterDictionary
- #yamlPath = sessionPath/'config_yaml'
- #print(config_settings,yaml_name)
- with open(yaml_name, 'w') as outfile:
- config_yaml.dump(config_settings, outfile)
-
-
-def load_config_yaml(yaml_path):
- config_yaml = YAML()
- with open(yaml_path,'r') as fp:
- config_settings = config_yaml.load(fp)
- return config_settings
-
-def load_session_paths(session,config_settings):
- configPaths = config_settings['Paths']
- session.rawVidPath = Path(configPaths['rawVidPath'])
- session.syncedVidPath = Path(configPaths['syncedVidPath'])
- session.calVidPath = Path(configPaths['calVidPath'])
- session.mediaPipeDataPath = Path(configPaths['mediaPipeDataPath'])
- session.openPoseDataPath = Path(configPaths['openPoseDataPath'])
- session.dlcDataPath = Path(configPaths['dlcDataPath'])
- session.imOutPath = Path(configPaths['imOutPath'])
- session.dataArrayPath = Path(configPaths['dataArrayPath'])
+# #yamlPath = sessionPath/'config_yaml'
+# #print(config_settings,yaml_name)
+# with open(yaml_name, 'w') as outfile:
+# config_yaml.dump(config_settings, outfile)
+
+
+# def load_config_yaml(yaml_path):
+# config_yaml = YAML()
+# with open(yaml_path,'r') as fp:
+# config_settings = config_yaml.load(fp)
+# return config_settings
+
+# def load_session_paths(session,config_settings):
+# configPaths = config_settings['Paths']
+# session.rawVidPath = Path(configPaths['rawVidPath'])
+# session.syncedVidPath = Path(configPaths['syncedVidPath'])
+# session.calVidPath = Path(configPaths['calVidPath'])
+# session.mediaPipeDataPath = Path(configPaths['mediaPipeDataPath'])
+# session.openPoseDataPath = Path(configPaths['openPoseDataPath'])
+# session.dlcDataPath = Path(configPaths['dlcDataPath'])
+# session.imOutPath = Path(configPaths['imOutPath'])
+# session.dataArrayPath = Path(configPaths['dataArrayPath'])
diff --git a/freemocap/runcams.py b/freemocap/runcams.py
index 96c2dee9..30b80d2b 100644
--- a/freemocap/runcams.py
+++ b/freemocap/runcams.py
@@ -10,7 +10,9 @@ from tkinter import Tk
def RecordCams(session,camInputs,parameterDictionary,rotationInputs):
-
+ #Create RawVideos folder
+ session.rawVidPath.mkdir(exist_ok = True)
+
#%% Setting up recordings
beginTime = time.time()
numCams = len(camInputs) #number of cameras
@@ -58,15 +60,17 @@ def RecordCams(session,camInputs,parameterDictionary,rotationInputs):
timeStampData.to_csv(csvPath) #turn dataframe into a CSV
session.numCams = numCams
+ session.session_settings['recording_parameters'].update({'numCams':session.numCams})
session.timeStampData = timeStampData
session.camIDs = camIDs
session.numCamRange = numCamRange
session.vidNames = vidNames
def SyncCams(session, timeStampData,numCamRange,vidNames,camIDs):
+ session.syncedVidPath.mkdir(exist_ok = True)
#start the timesync process
- frameTable,timeTable,frameRate,resultsTable,plots = timesync.TimeSync(timeStampData,numCamRange,camIDs)
+ frameTable,timeTable,frameRate,resultsTable,plots = timesync.TimeSync(session,timeStampData,numCamRange,camIDs)
#this message shows you your percentages and asks if you would like to continue or not. shuts down the program if no
root = Tk()
@@ -77,5 +81,6 @@ def SyncCams(session, timeStampData,numCamRange,vidNames,camIDs):
print()
print('Starting editing')
videotrim.VideoTrim(session,vidNames,frameTable,session.parameterDictionary,session.rotationInputs,numCamRange)
+ session.session_settings['recording_parameters'].update({'numFrames':session.numFrames})
#videotrim.createCalibrationVideos(session,60,parameterDictionary)
print('all done')
\ No newline at end of file
diff --git a/freemocap/session.py b/freemocap/session.py
index 7975528d..82c511e4 100644
--- a/freemocap/session.py
+++ b/freemocap/session.py
@@ -1,8 +1,20 @@
-class Session: #session like "recording session"
+from pathlib import Path
+from ruamel.yaml import YAML
+
+from freemocap import recordingconfig
+
+class Session: #self like "recording self"
def __init__(self):
+
+ self.numCams = None
+ self.numFrames = None
+ self.numTrackedPoints = None
+
+ self.basePath = Path.cwd()
+
self.sessionID = '' #The sessionID tag will be used to generate files names and whatnot
self.sessionPath = '' #The folder where the to-be-processed videos live (in a folder called "synced Vids")
- self.numCams = ''#The number of cameras used in this recording session
+ #self.numCams = ''#The number of cameras used in this recording self
self.openPoseDataPath = ''#Where the open pose data lives
self.dlcDataPath = ''#Where the DLC data lives
self.openPoseExePath = r'C:\openpose'
@@ -17,4 +29,161 @@ class Session: #session like "recording session"
self.skel_fr_mar_dim = None
self.mediaPipe_imgPathList = None
- self.openPose_imgPathList = None
\ No newline at end of file
+ self.openPose_imgPathList = None
+
+ def start_session(self,paramDict,rotDict):
+ #start a session, create all the file paths necessary, and create a session dictionary to save settings
+ recordPath = self.basePath/'Data'
+ recordPath.mkdir(exist_ok= True)
+
+ self.sessionPath = recordPath/self.sessionID
+ self.sessionPath.mkdir(exist_ok=True)
+
+ #create all the session filepaths and settings - create and load them into a dictionary
+ self.pathList = self.create_session_paths()
+ self.session_settings = self.create_session_dictionary()
+ self.create_session_txt(paramDict,rotDict)
+
+
+
+ def create_session_paths(self):
+ #creates Path objects to each folder created in a recording self and adds them all to the pathList variable
+ #folders for these paths are created at the start of each stage where they are needed
+
+ pathList = []
+
+ self.rawVidPath = self.sessionPath/'RawVideos'
+ pathList.append(self.rawVidPath)
+
+ self.syncedVidPath = self.sessionPath/'SyncedVideos'
+ pathList.append(self.syncedVidPath)
+
+ self.calVideos = self.sessionPath/'CalVideos'
+ pathList.append(self.calVideos)
+
+ self.dataArrays = self.sessionPath/'DataArrays'
+ pathList.append(self.dataArrays)
+
+ self.DLCData = self.sessionPath/'DLCData'
+ pathList.append(self.DLCData)
+
+ self.openPoseDataPath = self.sessionPath/'OpenPoseData'
+ pathList.append(self.openPoseDataPath)
+
+ self.mediaPipeDataPath = self.sessionPath/'MediaPipeData'
+ pathList.append(self.mediaPipeDataPath)
+
+ self.imOutPath = self.sessionPath/'imOut'
+ pathList.append(self.imOutPath)
+
+ return pathList
+
+ def create_session_dictionary(self):
+ #creates a dictionary of settings that should be saved into a YAML throughout each self
+
+ recording_parameters = {'numCams': self.numCams, 'numFrames': self.numFrames, 'numTrackedPoints': self.numTrackedPoints}
+
+ #create a dictionary with the folder names (taken from the recordingconfig.py file) and the folder paths from pathList
+ #NOTE -6/30/21 - as of right now, the order of folder names in the recordingconfig.folder_setup list needs to match the
+ # the order of folder paths in the pathList
+ session_paths = {}
+
+ for foldername, folderpath in zip(recordingconfig.folder_setup,self.pathList):
+ session_paths[foldername] = folderpath
+
+ session_settings_dictionary = {'recording_parameters':recording_parameters, 'session_paths':session_paths}
+
+ return session_settings_dictionary
+
+
+ def create_session_txt(self,paramDict,rotDict):
+ #create a text file listing recording parameters
+ parameter_text = self.sessionPath/'sessionSettings.txt'
+ text = open(parameter_text, 'w')
+ text.write("Session ID = %s\n" %(self.sessionID))
+ text.write("%s = %s\n" %("Parameters", paramDict))
+ text.write("%s = %s\n" %("Rotations", rotDict))
+ text.close()
+
+ def save_session(self):
+ #save the self settings you want to keep from self to self into a yaml
+ #because some items are not yaml-able, a copy of the sessionDictionary is made and adjusted to be fully yaml-able
+ #Adjustments Made:
+ #pathLib objects are all converted to strings
+ session_dictionary_to_save = self.session_settings
+
+ for key,value in session_dictionary_to_save['session_paths'].items():
+ session_dictionary_to_save['session_paths'][key] = str(value)
+
+ session_yaml_path = self.sessionPath/'{}_config.yaml'.format(self.sessionID)
+ session_yaml = YAML()
+
+ with open(session_yaml_path,'w') as outfile:
+ session_yaml.dump(session_dictionary_to_save,outfile)
+
+
+ def initialize(self,stage):
+ #load all session settings back into the session class for this run-through of the code
+
+ recordPath = self.basePath/'Data' #create a Data folder in the filepath if none exists yet
+ recordPath.mkdir(exist_ok= True)
+
+ self.sessionPath = recordPath/self.sessionID
+ self.sessionPath.mkdir(exist_ok=True)
+
+ self.session_settings = self.load_session()
+
+
+ def load_session(self):
+
+ session_yaml_path = self.sessionPath/'{}_config.yaml'.format(self.sessionID)
+ session_yaml = YAML(typ='safe', pure=True)
+
+ with open(session_yaml_path,'r') as fp:
+ session_dictionary_to_load = session_yaml.load(fp)
+
+ session_settings_dictionary = session_dictionary_to_load #create a copy of the loaded dictionary
+
+ for key,value in session_settings_dictionary['session_paths'].items():
+ session_settings_dictionary['session_paths'][key] = Path(value)
+
+ self.load_session_paths(session_settings_dictionary)
+ self.numCams = session_settings_dictionary['recording_parameters']['numCams']
+ self.numFrames = session_settings_dictionary['recording_parameters']['numFrames']
+ self.numTrackedPoints = session_settings_dictionary['recording_parameters']['numTrackedPoints']
+
+ return session_settings_dictionary
+ f = 2
+
+ def load_session_paths(self, session_settings_dict):
+
+ session_paths = session_settings_dict['session_paths']
+
+ self.rawVidPath = session_paths['RawVideos']
+ self.syncedVidPath = session_paths['SyncedVideos']
+ self.calVidPath = session_paths['CalVideos']
+ self.mediaPipeDataPath = session_paths['MediaPipeData']
+ self.openPoseDataPath = session_paths['OpenPoseData']
+ self.dlcDataPath = session_paths['DLCData']
+ self.imOutPath = session_paths['imOut']
+ self.dataArrayPath = session_paths['DataArrays']
+
+
+
+ f = 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/freemocap/webcam/timesync.py b/freemocap/webcam/timesync.py
index 814fe391..e857c529 100644
--- a/freemocap/webcam/timesync.py
+++ b/freemocap/webcam/timesync.py
@@ -6,7 +6,7 @@ from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import tkinter as tk
from tkinter import Tk,Label, Button, Frame
-def TimeSync(timeStampData,numCamRange,camNames):
+def TimeSync(session,timeStampData,numCamRange,camNames):
def CloseNeighb(camera,point):
closestPoint = (np.abs(camera - point)).argmin()
@@ -26,7 +26,7 @@ def TimeSync(timeStampData,numCamRange,camNames):
#print('end',endList)
print('intervals:',masterTimelineBegin,masterTimelineEnd)
-
+ preSyncTotalNumFrames = []
totalFrameIntvl= [] #list for storing frame rates for each camera
@@ -36,12 +36,23 @@ def TimeSync(timeStampData,numCamRange,camNames):
#finds the closest point in each camera to the start and end points of our timeline
currentCamStart = CloseNeighb(currentCam,masterTimelineBegin)
currentCamEnd = CloseNeighb(currentCam,masterTimelineEnd)
+
+
print("using frames:", currentCamStart,"-",currentCamEnd,"for",camNames[n])
n +=1
currentCamTimeline = currentCam[currentCamStart:currentCamEnd] #grab the times from start to finish for each camera
+
+ currentCamNumFrames = len(currentCamTimeline)
+
currentCamFrameInterval = np.mean(np.diff(currentCamTimeline)) #calculate the interval between each frame and take the mean
+
totalFrameIntvl.append(currentCamFrameInterval) #add interval to list
+ preSyncTotalNumFrames.append(currentCamNumFrames)
#print(camNames[x],currentCamStart,currentCamEnd)
+
+ #print(preSyncTotalNumFrames, 'presync')
+ #assert preSyncTotalNumFrames.count(preSyncTotalNumFrames[0]) == len(preSyncTotalNumFrames), "Number of frames sliced for each camera pre-syncing is not the same"
+
totalAverageIntvl = np.mean(totalFrameIntvl) #find the total average interval across all cameras
masterTimeline = np.arange(masterTimelineBegin,masterTimelineEnd,totalAverageIntvl) #build a master timeline with the average interval
@@ -58,6 +69,8 @@ def TimeSync(timeStampData,numCamRange,camNames):
count = 0 #Keeps track of what frame we're on (I think?)
n = 0; #I don't remember why I did this but I'm sure I'll figure it out later
+
+ postSyncTotalNumFrames = []
for y in numCamRange:
thisCam = timeStampData[camNames[y]]
camTimes = []; #stored times
@@ -82,7 +95,10 @@ def TimeSync(timeStampData,numCamRange,camNames):
#start counters for the number of buffered and deleted slides
bufCount = 0;
delCount = 0;
-
+
+ thisCamNumFrames = len(camFrames)
+ postSyncTotalNumFrames.append(thisCamNumFrames)
+
for i in range(0,len(camFrames)-1):
distanceBetweenFrames = camFrames[i+1] - camFrames[i] #find the distance between adjacent frames
if distanceBetweenFrames == 1: #these frames are consecutive, do nothing
@@ -117,7 +133,12 @@ def TimeSync(timeStampData,numCamRange,camNames):
#print("deleted frames:",delCount)
#print("buffered frames:",bufCount)
n +=1
-
+
+ #print(postSyncTotalNumFrames, 'post-sync')
+ assert postSyncTotalNumFrames.count(postSyncTotalNumFrames[0]) == len(postSyncTotalNumFrames), "Number of frames sliced for each camera post-syncing is not the same"
+
+ session.postSyncNumFrames = postSyncTotalNumFrames[0]
+
#create our data frame for both times and frames
frameTable = pd.DataFrame(frameList)
columnNames = ['Master Timeline'] + camNames
diff --git a/freemocap/webcam/videotrim.py b/freemocap/webcam/videotrim.py
index 4f4e8924..67609eb0 100644
--- a/freemocap/webcam/videotrim.py
+++ b/freemocap/webcam/videotrim.py
@@ -13,6 +13,8 @@ def VideoTrim(session,vidList,ft,parameterDictionary,rotationState,numCamRange):
trueHeight = resHeight
codec = parameterDictionary.get('codec')
+ postTrimmingTotalNumFrames = []
+
for vid,cam,camNum in zip(vidList,camList,numCamRange): #iterate in parallel through camera identifiers and matching videos
print('Editing '+cam+' from ' +vid)
cap = cv2.VideoCapture(str(session.rawVidPath/vid)) #initialize OpenCV capture
@@ -48,9 +50,17 @@ def VideoTrim(session,vidList,ft,parameterDictionary,rotationState,numCamRange):
resHeight = trueHeight
cap.release()
out.release()
+ frame_length_cap = cv2.VideoCapture(saveSyncedVidPath)
+ thisCamNumFrame = int(frame_length_cap.get(cv2.CAP_PROP_FRAME_COUNT))
+ postTrimmingTotalNumFrames.append(thisCamNumFrame)
print('Saved '+ saveSyncedVidPath)
print()
+ assert postTrimmingTotalNumFrames.count(postTrimmingTotalNumFrames[0]) == len(postTrimmingTotalNumFrames), "Number of frames in each synced video is not the same"
+ session.postTrimmingNumFrames = postTrimmingTotalNumFrames[0]
+ session.numFrames = postTrimmingTotalNumFrames[0]
+
+
def createCalibrationVideos(session,calVideoFrameLength,parameterDictionary):
vidList = os.listdir(session.syncedVidPath)
framelist = list(range(calVideoFrameLength))
diff --git a/parameters.yaml b/parameters.yaml
index aac3d904..3b5b4f93 100644
--- a/parameters.yaml
+++ b/parameters.yaml
@@ -20,12 +20,11 @@ default:
saved:
rotations:
- 0: 270
- 1: 90
- 2: 90
- 3: 90
+ 0: 0
+ 1: 0
+ 2: 0
parameters:
- exposure: -8
+ exposure: -5
resWidth: 640
resHeight: 480
framerate: 30
diff --git a/runme_fmc_staged.py b/runme_fmc_staged.py
index 247fc954..653611c1 100644
--- a/runme_fmc_staged.py
+++ b/runme_fmc_staged.py
@@ -15,6 +15,8 @@ sesh.useOpenPose= True
sesh.useMediaPipe = False
sesh.useDLC=False
+
+
if sesh.useDLC:
import deeplabcut as dlc
# sesh.dlcConfigPath = Path("C:\\Users\\jonma\\Dropbox\\GitKrakenRepos\\freemocap\\DLC_Models\\PinkGreenRedJugglingBalls-JSM-2021-05-31\\config.yaml")
@@ -23,10 +25,16 @@ if sesh.useDLC:
# %% Inputs to edit
-stage = 6 #set your starting stage here (stage = 1 will run the pipeline from webcams)
+stage = 1 #set your starting stage here (stage = 1 will run the pipeline from webcams)
sesh.debug = False
-sesh.sessionID = 'sesh_21_06_22_1_CyrWheel' #fill in if you are running from Stage 2 onwards
+sesh.sessionID = 'sesh_21-06-29_141040' #fill in if you are running from Stage 2 onwards
+
+#sesh.start_session()
+
+
+#sesh.initialize(stage)
+
if not sesh.sessionID:
dataFolder = Path.cwd()/'Data'
@@ -51,7 +59,7 @@ board = CharucoBoard(7, 5,
# %% Initialization
-
+#sesh.initialize(stage)
initialization.initialize(sesh,stage,board)
# %% Stage One
@@ -59,6 +67,7 @@ if stage <= 1:
print()
print('Starting Video Recordings')
runcams.RecordCams(sesh, sesh.cam_inputs, sesh.parameterDictionary, sesh.rotationInputs)
+ sesh.save_session()
else:
print('Skipping Video Recording')
@@ -68,6 +77,7 @@ if stage <= 2:
print()
print('Starting Video Syncing')
runcams.SyncCams(sesh, sesh.timeStampData,sesh.numCamRange,sesh.vidNames,sesh.camIDs)
+ sesh.save_session()
else:
print('Skipping Video Syncing')