Free Motion Capture for Everyone πβ¨
TypeScript
clean up merge issues
jon matthis37e5fea4549d
diff --git a/freemocap/calibrate.py b/freemocap/calibrate.pyindex 0cf44b5f..f66ac250 100644--- a/freemocap/calibrate.py+++ b/freemocap/calibrate.py@@ -10,7 +10,6 @@ import osfrom rich.progress import track-def CalibrateCaptureVolume(session, board):def CalibrateCaptureVolume(session,board):diff --git a/freemocap/createvideo.py b/freemocap/createvideo.pyindex 2c790db2..96b161c1 100644--- a/freemocap/createvideo.py+++ b/freemocap/createvideo.py@@ -37,13 +37,7 @@ def createBodyTrackingVideos(session):if session.useOpenPose:-<<<<<<< HEAD- for count, videoPath in enumerate(- session.config_settings["openPose_imgPathList"]- ):-=======for count,videoPath in enumerate(session.session_settings['openPose_imgPathList']):->>>>>>> merge-pipy-aaronframe_array = []vidSavePath = str(session.openPoseDataPath / "openPoseVideo_cam{}.mp4".format(count)diff --git a/freemocap/fmc_openpose.py b/freemocap/fmc_openpose.pyindex 89758940..b9521381 100644--- a/freemocap/fmc_openpose.py+++ b/freemocap/fmc_openpose.py@@ -65,15 +65,6 @@ def runOpenPose(session, dummyRun=False):print("Skipping: ", thisVidPath.name)session.openPose_jsonPathList = openPose_jsonPathListsession.openPose_imgPathList = openPose_imgPathList-<<<<<<< HEAD-- yaml = YAML()- data = yaml.load(session.yamlPath)- data["openPose_imgPathList"] = openPose_imgPathList_yaml- data["openPose_jsonPathList"] = openPose_jsonPathList_yaml- yaml.dump(data, session.yamlPath)--=======session.session_settings['openPose_imgPathList'] = openPose_imgPathList_yamlsession.session_settings['openPose_jsonPathList'] = openPose_jsonPathList_yaml@@ -83,133 +74,11 @@ def runOpenPose(session, dummyRun=False):# data['openPose_jsonPathList'] = openPose_jsonPathList_yaml# yaml.dump(data, session.session_yaml_path)->>>>>>> merge-pipy-aaronos.chdir(session.sessionPath)# @jit(nopython=True)def parseOpenPose(session):-<<<<<<< HEAD- thisCamNum = -1-- ## %%- # build header for dataframe - NOTE - #openpose data comes in a line ordered 'pixel x location (px)', 'pixel y (py)', 'confidence (conf)' for each keypoint-- dataFrameHeader = []- bodyCols = 75- handCols = 63 # per hand- faceCols = 210 # das alotta face!- headerLength = (- bodyCols + 2 * handCols + faceCols- ) # should be 411 for whatever version of openpose i was using on 11 Jan 2021- numImgPoints = headerLength-- for bb in range(- 0, int(bodyCols / 3)- ): # loop through the number of body markers (i.e. #bodyCols/3)- dataFrameHeader.append("body_" + str(bb).zfill(3) + "_pixx")- dataFrameHeader.append("body_" + str(bb).zfill(3) + "_pixy")- dataFrameHeader.append("body_" + str(bb).zfill(3) + "_conf")-- for hr in range(- 0, int(handCols / 3)- ): # loop through the number of handR markers (i.e. #handCols/3)- dataFrameHeader.append("handR_" + str(hr).zfill(3) + "_pixx")- dataFrameHeader.append("handR_" + str(hr).zfill(3) + "_pixy")- dataFrameHeader.append("handR_" + str(hr).zfill(3) + "_conf")-- for hl in range(- 0, int(handCols / 3)- ): # loop through the number of handL markers (i.e. #handCols/3)- dataFrameHeader.append("handL_" + str(hl).zfill(3) + "_pixx")- dataFrameHeader.append("handL_" + str(hl).zfill(3) + "_pixy")- dataFrameHeader.append("handL_" + str(hl).zfill(3) + "_conf")-- for ff in range(- 0, int(faceCols / 3)- ): # loop through the number of Face markers (i.e. #faceCols/3)- dataFrameHeader.append("face_" + str(ff).zfill(3) + "_pixx")- dataFrameHeader.append("face_" + str(ff).zfill(3) + "_pixy")- dataFrameHeader.append("face_" + str(ff).zfill(3) + "_conf")-- assert len(dataFrameHeader) == headerLength, [- "Header is the wrong length! Should be "- + str(headerLength)- + " but it is "- + str(len(dataFrameHeader))- + " Check version of OpenPose?"- ]-- ## %%- ## load in data from json files- numFrames = int(len(list(Path(session.openPose_jsonPathList[0]).glob("*")))) # lol- numMarkers = int(int(len(dataFrameHeader) / 3))- numCams = int(session.numCams)-- openPoseData_nCams_nFrames_nImgPts_XYC = np.ndarray(- [numCams, numFrames, numMarkers, 3]- ) # hardcoding for now because I am a bad person-- for thisCams_JsonFolderPath in track(- session.openPose_jsonPathList,- description="Parsing json's into a dataframe (per cam)",- ):- thisCamNum += 1- # print('Parsing into a dataframe: ', thisCams_JsonFolderPath.name )- jsonPaths = sorted(- Path(thisCams_JsonFolderPath).glob("*.json")- ) # glob is a "generator(?)" for paths to all the jason for THIS camara-- for (- thisJsonPath- ) in (- jsonPaths- ): # loop throug all the json files and save their 'people' data to a dictionary (which will then be formatted into a pandas dataframe). NOTE - will be empty array if no hoomans visible in frame- # print('loading: ', thisJsonPath.name)- frameNum = int(thisJsonPath.stem.split("_")[-2]) # frame number we're on- thisJsonData = json.loads(thisJsonPath.read_bytes())- thisJsonData = thisJsonData[- "people"- ] # #FEATURE_REQUEST - at some point, we should check the openpose version (save it with the data somehow, verify everything is the same version, use different markernamlists for different versions, etc)-- if thisJsonData: # if this json has data- bodyData = np.array(thisJsonData[0]["pose_keypoints_2d"])- handRData = np.array(thisJsonData[0]["hand_right_keypoints_2d"])- handLData = np.array(thisJsonData[0]["hand_left_keypoints_2d"])- faceData = np.array(thisJsonData[0]["face_keypoints_2d"])- thisFrameRow = np.hstack(- (bodyData, handRData, handLData, faceData)- ) # horizontally concatenate these arrays- else: # if this json is empty, just stuff it fulla NaNs- thisFrameRow = np.empty([headerLength])- thisFrameRow.fill(np.nan)-- assert thisFrameRow.size == headerLength, [- "Header is the wrong length! Should be "- + str(headerLength)- + " but it is "- + str(thisFrameRow.size)- + " Check version of OpenPose?"- ]-- if (- frameNum < openPoseData_nCams_nFrames_nImgPts_XYC.shape[1]- ): # NOTE: THIS SHOULDN"T BE NECESSARY. CURRENT Vid Trim Methods can (apparently) produce vids with off-by-one numbers of frames- openPoseData_nCams_nFrames_nImgPts_XYC[- thisCamNum, frameNum, :, :- ] = np.reshape(- thisFrameRow, [137, 3]- ) # hard coding b/c I'm a bad person-- # session.dataFrameHeader = dataFrameHeader- # session.numImgPoints = numImgPoints- session.numFrames = frameNum # NOTE - Need to find a safer way to get this number-- path_to_openpose_2d = session.dataArrayPath / "openPoseData_2d.npy"- np.save(path_to_openpose_2d, openPoseData_nCams_nFrames_nImgPts_XYC)-- return openPoseData_nCams_nFrames_nImgPts_XYC-=======thisCamNum = -1## %%@@ -291,4 +160,3 @@ def parseOpenPose(session):np.save(path_to_openpose_2d, openPoseData_nCams_nFrames_nImgPts_XYC)return openPoseData_nCams_nFrames_nImgPts_XYC->>>>>>> merge-pipy-aarondiff --git a/freemocap/fmc_pyqtgraph.py b/freemocap/fmc_pyqtgraph.pyindex cc9b7223..32cadfa0 100644--- a/freemocap/fmc_pyqtgraph.py+++ b/freemocap/fmc_pyqtgraph.py@@ -201,15 +201,8 @@ class PlaySkeletonWidget:self.tailLength = 10-<<<<<<< HEAD- self.charuco_mar_dim = np.load(session.dataArrayPath / "charuco_points.npy")- self.charucoScatterItem = gl.GLScatterPlotItem(- pos=self.charuco_mar_dim, color=(1, 1, 1, 0.8), size=10, pxMode=False- )-=======self.charuco_mar_dim = np.load(session.dataArrayPath/'charuco_3d_points.npy')self.charucoScatterItem = gl.GLScatterPlotItem(pos=self.charuco_mar_dim, color=(1,1,1,.8), size=10, pxMode=False)->>>>>>> merge-pipy-aaronself.Skel3dViewWidget.addItem(self.charucoScatterItem)# plot videos Frames!diff --git a/freemocap/parameters.yaml b/freemocap/parameters.yamlindex 057e4e87..c992ff60 100644--- a/freemocap/parameters.yaml+++ b/freemocap/parameters.yaml@@ -1,4 +1,5 @@-#default parameters+#default parameters+@@ -11,22 +12,16 @@ default:framerate: 25codec: DIVX-#saved parameters+#saved parameters+saved:rotations:-<<<<<<< HEAD:parameters.yaml- 0: 90- 1: 270- 2: 90- 3: 270-=======1: 02: 0->>>>>>> merge-pipy-aaron:freemocap/parameters.yamlparameters:exposure: -6resWidth: 640diff --git a/freemocap/playskeleton.py b/freemocap/playskeleton.pyindex 8061a9eb..8d00cdd4 100644--- a/freemocap/playskeleton.py+++ b/freemocap/playskeleton.py@@ -37,12 +37,8 @@ def ReplaySkeleton_matplotlib(useDLC=False,):-<<<<<<< HEAD- mean_charuco_fr_mar_dim = np.load(session.dataArrayPath / "charuco_points.npy")-=======mean_charuco_fr_mar_dim = np.load(session.dataArrayPath/'charuco_3d_points.npy')->>>>>>> merge-pipy-aaronif useOpenPose:skel_fr_mar_dim = np.load(session.dataArrayPath / "openPoseSkel_3d.npy")@@ -60,22 +56,6 @@ def ReplaySkeleton_matplotlib(ballTrailLen = 4if useOpenPose:-<<<<<<< HEAD- imgPathList = session.config_settings["openPose_imgPathList"]- session.numCams = len(session.openPose_imgPathList)-- camImgPathList = {}- for cam in range(session.numCams):- camImgPathList[cam] = list(sorted(Path(imgPathList[cam]).glob("*.png")))- session.numFrames = len(- camImgPathList[cam]- ) # will need to perhaps put a check in on whether numFrames between cameras are the same-- # define Skeleton connections- # head = [17, 15, 0, 16, 18]- head = [15, 0, 16]- spine = [0, 1, 8]-=======imgPathList = session.session_settings['openPose_imgPathList']@@ -89,7 +69,6 @@ def ReplaySkeleton_matplotlib(# head = [17, 15, 0, 16, 18]head = [ 15, 0, 16]spine = [0,1,8]->>>>>>> merge-pipy-aaronrArm = [17, 15, 0, 16, 18]rArm = [4, 3, 2, 1]lArm = [1, 5, 6, 7]@@ -323,27 +302,6 @@ def ReplaySkeleton_matplotlib(########################################################################################################################################-def ReplaySkeleton_matplotlib(- session,- vidType=1,- startFrame=40,- azimuth=-90,- elevation=-80,- useOpenPose=True,- useMediaPipe=False,- useDLC=False,-):--<<<<<<< HEAD- mean_charuco_fr_mar_dim = np.load(session.dataArrayPath / "charuco_points.npy")-- if session.useMediaPipe:- mediaPipe_skel_fr_mar_dim = np.load(- session.dataArrayPath / "mediaPipeSkel_3d.npy"- )- imgPathList = session.config_settings["mediaPipe_imgPathList"]-=======-def ReplaySkeleton_matplotlib( session,vidType=1,@@ -361,21 +319,13 @@ def ReplaySkeleton_matplotlib( session,if session.useMediaPipe:mediaPipe_skel_fr_mar_dim = np.load(session.dataArrayPath/'mediaPipeSkel_3d.npy')imgPathList = session.session_settings['mediaPipe_imgPathList']->>>>>>> merge-pipy-aaronsession.numCams = len(session.mediaPipe_imgPathList)if session.useOpenPose:-<<<<<<< HEAD- skel_fr_mar_dim = np.load(session.dataArrayPath / "openPoseSkel_3d.npy")- imgPathList = session.config_settings["openPose_imgPathList"]- session.numCams = len(session.openPose_imgPathList)--=======skel_fr_mar_dim = np.load(session.dataArrayPath/'openPoseSkel_3d.npy')imgPathList = session.session_settings['openPose_imgPathList']#session.numCams = len(session.openPose_imgPathList)->>>>>>> merge-pipy-aaronif session.useDLC:dlc_fr_mar_dim = np.load(session.dataArrayPath / "deepLabCut_3d.npy")dlc0 = np.squeeze(dlc_fr_mar_dim[:, 0, :])@@ -385,18 +335,6 @@ def ReplaySkeleton_matplotlib( session,camImgPathList = {}for cam in range(session.numCams):-<<<<<<< HEAD- camImgPathList[cam] = list(sorted(Path(imgPathList[cam]).glob("*.png")))- session.numFrames = len(- camImgPathList[cam]- ) # will need to perhaps put a check in on whether numFrames between cameras are the same-- # define Skeleton connections- # head = [17, 15, 0, 16, 18]- head = [15, 0, 16]- spine = [0, 1, 8]- rArm = [4, 3, 2, 1]-=======camImgPathList[cam] = list(sorted(Path(imgPathList[cam]).glob('*.png')))#session.numFrames = len(camImgPathList[cam]) #will need to perhaps put a check in on whether numFrames between cameras are the same@@ -406,7 +344,6 @@ def ReplaySkeleton_matplotlib( session,head = [ 15, 0, 16]spine = [0,1,8]rArm = [4 ,3 ,2 ,1]->>>>>>> merge-pipy-aaronlArm = [1, 5, 6, 7]rLeg = [11, 10, 9, 8]lLeg = [14, 13, 12, 8]diff --git a/freemocap/recordingconfig.py b/freemocap/recordingconfig.pyindex 2ecca474..30cb5bd0 100644--- a/freemocap/recordingconfig.py+++ b/freemocap/recordingconfig.py@@ -5,7 +5,6 @@ Created on Thu Mar 11 11:54:12 2021@author: Rontc"""-<<<<<<< HEADdef createSession(session, filepath, existing_data=False):# create file paths for the session, raw and synced videos@@ -77,7 +76,6 @@ def createSessionTxt(session, paramDict, rotDict):text.write("%s = %s\n" % ("Rotations", rotDict))text.close()-=======folder_setup = ['RawVideos','SyncedVideos','CalVideos','DataArrays','DLCData','OpenPoseData','MediaPipeData','imOut']@@ -157,9 +155,8 @@ folder_setup = ['RawVideos','SyncedVideos','CalVideos','DataArrays','DLCData','O# def create_config_yaml():->>>>>>> merge-pipy-aaron-def create_config_yaml():+# def create_config_yaml():# yaml_str = """\# # Camera Inputs@@ -183,46 +180,10 @@ def create_config_yaml():# config_yaml = YAML()# config_settings = config_yaml.load(yaml_str)-<<<<<<< HEAD- return config_settings, config_yaml--=======# return config_settings,config_yaml->>>>>>> merge-pipy-aaron--def write_config_yaml(session, config_settings, config_yaml, pathList, yaml_name):--<<<<<<< HEAD- 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-- # 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 write_config_yaml(session, config_settings, config_yaml, pathList, yaml_name):-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"])-=======# def write_config_yaml(session,config_settings,config_yaml,pathList,yaml_name):# for count,key in enumerate(config_settings['Paths'].keys()):@@ -254,4 +215,3 @@ def load_session_paths(session, config_settings):# session.dlcDataPath = Path(configPaths['dlcDataPath'])# session.imOutPath = Path(configPaths['imOutPath'])# session.dataArrayPath = Path(configPaths['dataArrayPath'])->>>>>>> merge-pipy-aarondiff --git a/freemocap/runcams.py b/freemocap/runcams.pyindex 9defb0c9..343f6f0d 100644--- a/freemocap/runcams.py+++ b/freemocap/runcams.py@@ -8,13 +8,9 @@ import numpy as npfrom tkinter import Tk-<<<<<<< HEAD-def RecordCams(session, camInputs, parameterDictionary, rotationInputs):-=======def RecordCams(session,camInputs,parameterDictionary,rotationInputs):#Create RawVideos foldersession.rawVidPath.mkdir(exist_ok = True)->>>>>>> merge-pipy-aaron#%% Setting up recordingsbeginTime = time.time()@@ -85,17 +81,6 @@ def RecordCams(session,camInputs,parameterDictionary,rotationInputs):session.numCamRange = numCamRangesession.vidNames = vidNames-<<<<<<< HEAD--def SyncCams(session, timeStampData, numCamRange, vidNames, camIDs):-- # start the timesync process- frameTable, timeTable, frameRate, resultsTable, plots = timesync.TimeSync(- 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-=======def SyncCams(session, timeStampData,numCamRange,vidNames,camIDs):session.syncedVidPath.mkdir(exist_ok = True)@@ -103,7 +88,6 @@ def SyncCams(session, timeStampData,numCamRange,vidNames,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->>>>>>> merge-pipy-aaronroot = Tk()proceed = timesync.proceedGUI(root, resultsTable, plots@@ -112,22 +96,8 @@ def SyncCams(session, timeStampData,numCamRange,vidNames,camIDs):if proceed.proceed == True:print()-<<<<<<< HEAD- print("Starting editing")- videotrim.VideoTrim(- session,- vidNames,- frameTable,- session.parameterDictionary,- session.rotationInputs,- numCamRange,- )- # videotrim.createCalibrationVideos(session,60,parameterDictionary)- print("all done")-=======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')->>>>>>> merge-pipy-aarondiff --git a/freemocap/session.py b/freemocap/session.pyindex dac7701d..73672c48 100644--- a/freemocap/session.py+++ b/freemocap/session.py@@ -1,15 +1,3 @@-<<<<<<< HEAD-class Session: # session like "recording session"- def __init__(self):- 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.openPoseDataPath = "" # Where the open pose data lives- self.dlcDataPath = "" # Where the DLC data lives- self.openPoseExePath = r"C:\openpose"-=======from pathlib import Pathfrom ruamel.yaml import YAML@@ -30,7 +18,6 @@ class Session: #self like "recording self"self.openPoseDataPath = ''#Where the open pose data livesself.dlcDataPath = ''#Where the DLC data livesself.openPoseExePath = r'C:\openpose'->>>>>>> merge-pipy-aaronself.cam_inputs = Noneself.parameterDictionary = None@@ -43,8 +30,6 @@ class Session: #self like "recording self"self.mediaPipe_imgPathList = Noneself.openPose_imgPathList = None-<<<<<<< HEAD-=======def start_session(self,paramDict,rotDict):#start a session, create all the file paths necessary, and create a session dictionary to save settings@@ -217,4 +202,3 @@ class Session: #self like "recording self"->>>>>>> merge-pipy-aarondiff --git a/freemocap/webcam/timesync.py b/freemocap/webcam/timesync.pyindex 45009978..9485cc1a 100644--- a/freemocap/webcam/timesync.py+++ b/freemocap/webcam/timesync.py@@ -6,14 +6,11 @@ from matplotlib.backends.backend_tkagg import FigureCanvasTkAggimport tkinter as tkfrom tkinter import Tk, Label, Button, Frame-<<<<<<< HEAD-=======def TimeSync(session,timeStampData,numCamRange,camNames):def CloseNeighb(camera,point):closestPoint = (np.abs(camera - point)).argmin()return closestPoint->>>>>>> merge-pipy-aarondef TimeSync(timeStampData, numCamRange, camNames):def CloseNeighb(camera, point):@@ -28,60 +25,6 @@ def TimeSync(timeStampData, numCamRange, camNames):timeStampData[name].last_valid_index()] # find the last non-nan value in each cameralastPoints.append(cameraLastPoint)-<<<<<<< HEAD-- masterTimelineEnd = np.floor(- min(lastPoints)- ) # find where the fastest camera ended, round down, use that as the end point-- # print('end',endList)- print("intervals:", masterTimelineBegin, masterTimelineEnd)-- totalFrameIntvl = [] # list for storing frame rates for each camera-- n = 0- # counter for going through camera names- for x in numCamRange:- currentCam = timeStampData[camNames[x]]- # 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- currentCamFrameInterval = np.mean(- np.diff(currentCamTimeline)- ) # calculate the interval between each frame and take the mean- totalFrameIntvl.append(currentCamFrameInterval) # add interval to list- # print(camNames[x],currentCamStart,currentCamEnd)- 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-- # now we start the syncing process-- frameList = masterTimeline # start a list of frames, with the first row being our master timeline- timeList = masterTimeline # start a list of timestamps,with the first row being our master timeline-- delNum = []- # stores number of deleted frames/camera- bufNum = []- # stores number of buffered frames/camera- bufPercentList = []- # stores percentage of deleted frames/camera- delPercentList = []- # stores percentage of buffered frames/camera-- 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--=======masterTimelineEnd = np.floor(min(lastPoints)) #find where the fastest camera ended, round down, use that as the end point@@ -134,7 +77,6 @@ def TimeSync(timeStampData, numCamRange, camNames):postSyncTotalNumFrames = []->>>>>>> merge-pipy-aaronfor y in numCamRange:thisCam = timeStampData[camNames[y]]camTimes = []@@ -147,37 +89,6 @@ def TimeSync(timeStampData, numCamRange, camNames):beginFrame = CloseNeighb(thisCam, masterTimeline[0])timeDif = masterTimeline[0] - thisCam[beginFrame]thisCam = thisCam + timeDif-<<<<<<< HEAD-- for z in masterTimeline: # for each point in the master timeline- closestFrame = CloseNeighb(- thisCam, z- ) # find the closest frame in this camera to each point of the master timeline- camFrames.append(closestFrame) # add that frame to the list- camTimes.append(- thisCam[closestFrame]- ) # find the time corresponding to this frame-- print(- "starting detection:", camNames[n]- ) # now to start finding deleted/buffered slides- frameList = np.column_stack(- (frameList, camFrames)- ) # update our framelist with our new frames- timeList = np.column_stack((timeList, camTimes)) # update our timelist-- # start counters for the number of buffered and deleted slides- bufCount = 0- delCount = 0-- 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- None- elif distanceBetweenFrames == 0: # we have a buffered slide-=======for z in masterTimeline: #for each point in the master timelineclosestFrame = CloseNeighb(thisCam, z) #find the closest frame in this camera to each point of the master timeline@@ -201,7 +112,6 @@ def TimeSync(timeStampData, numCamRange, camNames):if distanceBetweenFrames == 1: #these frames are consecutive, do nothingNoneelif distanceBetweenFrames == 0: #we have a buffered slide->>>>>>> merge-pipy-aaronbufCount += 1# this section looks at our two timepoints, and finds the which point on the master timeline is closestframe1 = abs(masterTimeline[i] - camTimes[i])@@ -218,25 +128,6 @@ def TimeSync(timeStampData, numCamRange, camNames):else:print("something else happened")-<<<<<<< HEAD- # update and calculate our percentages and numbers for buffers/deletions- delNum.append(round(delCount, 1))- bufNum.append(round(bufCount, 1))- # print(bufCount,len(frameList))- bufPercent = (bufCount / len(frameList)) * 100- delPercent = (delCount / len(frameList)) * 100- bufPercentList.append(round(bufPercent, 2))- delPercentList.append(round(delPercent, 2))-- # print(delNum,bufNum,bufPercentList,delPercentList)- # print("deleted frames:",delCount)- # print("buffered frames:",bufCount)- n += 1-- # create our data frame for both times and frames- frameTable = pd.DataFrame(frameList)- columnNames = ["Master Timeline"] + camNames-=======#update and calculate our percentages and numbers for buffers/deletionsdelNum.append(round(delCount,1))bufNum.append(round(bufCount,1))@@ -259,7 +150,6 @@ def TimeSync(timeStampData, numCamRange, camNames):#create our data frame for both times and framesframeTable = pd.DataFrame(frameList)columnNames = ['Master Timeline'] + camNames->>>>>>> merge-pipy-aaronframeTable.columns = columnNamestimeTable = pd.DataFrame(timeList)timeTable.columns = columnNamesdiff --git a/freemocap/webcam/videotrim.py b/freemocap/webcam/videotrim.pyindex 7d56298a..97802cc0 100644--- a/freemocap/webcam/videotrim.py+++ b/freemocap/webcam/videotrim.py@@ -16,17 +16,6 @@ def VideoTrim(session, vidList, ft, parameterDictionary, rotationState, numCamRatrueHeight = resHeightcodec = parameterDictionary.get("codec")-<<<<<<< HEAD- 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- frameTable = ft[cam] # grab the frames needed for that camera- success, image = cap.read() # start reading frames-=======postTrimmingTotalNumFrames = []for vid,cam,camNum in zip(vidList,camList,numCamRange): #iterate in parallel through camera identifiers and matching videos@@ -34,7 +23,6 @@ def VideoTrim(session, vidList, ft, parameterDictionary, rotationState, numCamRacap = cv2.VideoCapture(str(session.rawVidPath/vid)) #initialize OpenCV captureframeTable = ft[cam] #grab the frames needed for that camerasuccess, image = cap.read() #start reading frames->>>>>>> merge-pipy-aaronfourcc = cv2.VideoWriter_fourcc(*codec)saveName = session.sessionID + "_synced_" + cam + ".mp4"@@ -72,13 +60,6 @@ def VideoTrim(session, vidList, ft, parameterDictionary, rotationState, numCamRaresHeight = trueHeightcap.release()out.release()-<<<<<<< HEAD- print("Saved " + saveSyncedVidPath)- print()---def createCalibrationVideos(session, calVideoFrameLength, parameterDictionary):-=======frame_length_cap = cv2.VideoCapture(saveSyncedVidPath)thisCamNumFrame = int(frame_length_cap.get(cv2.CAP_PROP_FRAME_COUNT))postTrimmingTotalNumFrames.append(thisCamNumFrame)@@ -91,7 +72,6 @@ def createCalibrationVideos(session, calVideoFrameLength, parameterDictionary):def createCalibrationVideos(session,calVideoFrameLength,parameterDictionary):->>>>>>> merge-pipy-aaronvidList = os.listdir(session.syncedVidPath)framelist = list(range(calVideoFrameLength))codec = parameterDictionary.get("codec")diff --git a/freemocap/webcamGUI.py b/freemocap/webcamGUI.pyindex 07eb8f1d..753dfe5a 100644--- a/freemocap/webcamGUI.py+++ b/freemocap/webcamGUI.py@@ -24,14 +24,9 @@ def initialize(session, stage, board):sessionID_in = datetime.datetime.now().strftime("sesh_%y-%m-%d_%H%M%S")session.sessionID = sessionID_in-<<<<<<< HEAD:freemocap/initialization.py- # load the parameters YAML and extract the saved parameters if possible, and the default otherwise- parameter_path = filepath / "parameters.yaml"-=======#load the parameters YAML and extract the saved parameters if possible, and the default otherwisehere = Path(__file__).parentparameter_path = here/'parameters.yaml'->>>>>>> merge-pipy-aaron:freemocap/webcamGUI.pyparameters_yaml = YAML()parameters = parameters_yaml.load(parameter_path)@@ -39,26 +34,6 @@ def initialize(session, stage, board):rotation_entry = parameters["saved"]["rotations"]parameter_entry = parameters["saved"]["parameters"]except:-<<<<<<< HEAD:freemocap/initialization.py- print("Using Default Config")- rotation_entry = parameters["default"]["rotations"]- parameter_entry = parameters["default"]["parameters"]-- proceedToRecording = False # create this boolean, set it to false, and if the user wants to record- # later in the pipeline, it will be set to true-- # run the GUI to get the tasks, the cams chosen, the camera settings, and the session ID- task, cam_inputs, rotDict, paramDict, session.sessionID = recordGUI.RunGUI(- sessionID_in, rotation_entry, parameter_entry- )-- # update the saved parameters in the YAML- parameters["saved"]["rotations"] = rotDict- parameters["saved"]["parameters"] = paramDict- parameters_yaml.dump(parameters, parameter_path)-- # create a list from the rotation dictionary to be used in running webcams-=======print("Could not load saved parameters, using default parameters")rotation_entry = parameters['default']['rotations']parameter_entry = parameters['default']['parameters']@@ -80,7 +55,6 @@ def initialize(session, stage, board):#create a list from the rotation dictionary to be used in running webcams->>>>>>> merge-pipy-aaron:freemocap/webcamGUI.pyrotation_input = list(rotDict.values())if task == "setup":@@ -99,11 +73,6 @@ def initialize(session, stage, board):session.parameterDictionary = paramDictsession.rotationInputs = rotation_input-<<<<<<< HEAD:freemocap/initialization.py- # create a config yaml and text file for this session- config_yaml_path = recordingconfig.createSession(session, filepath)- recordingconfig.createSessionTxt(session, paramDict, rotDict)-=======#create a config yaml and text file for this sessionsession.start_session(session.parameterDictionary,session.rotationInputs)session.session_settings['recording_parameters']['RotationInputs'] = rotDict@@ -135,7 +104,6 @@ def initialize(session, stage, board):#from the config settings add the camera input parameters to parameter dictionarysession.parameterDictionary = session.session_settings['recording_parameters']['ParameterDict']session.rotationInputs = session.session_settings['recording_parameters']['RotationInputs']->>>>>>> merge-pipy-aaron:freemocap/webcamGUI.pyprint("Proceeding to Stage One")diff --git a/parameters.yaml b/parameters.yamlindex 92b9b5df..2ebbca88 100644--- a/parameters.yaml+++ b/parameters.yaml@@ -20,10 +20,10 @@ default:saved:rotations:- 0: 901: 2702: 903: 270+ 4: 0parameters:exposure: -8resWidth: 640diff --git a/runme_FreeMoCap.py b/runme_FreeMoCap.pyindex e8583289..dc309633 100644--- a/runme_FreeMoCap.py+++ b/runme_FreeMoCap.py@@ -25,7 +25,7 @@ sesh = session.Session()sesh.useOpenPose = Truesesh.useMediaPipe = False-sesh.useDLC = True+sesh.useDLC = Falseif sesh.useDLC:import deeplabcut as dlc