Skip to content

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

TypeScript

tweaks and cleanup

jon matthis6d4ef704cee9
diff --git a/freemocap/fmc_anipose.py b/freemocap/fmc_anipose.py
index a02ee6b6..2dee34aa 100644
--- a/freemocap/fmc_anipose.py
+++ b/freemocap/fmc_anipose.py
@@ -1,5 +1,5 @@
-#NOTE - this is altered version of code from Anipose - We should make this alteration in a forked repo of aniposelib rather than copying the py file and altering it in our repo
+#NOTE - this is altered version of code from Anipose (`aniposelib/cameras.py`) - We should make this alteration in a forked repo of aniposelib rather than copying the py file and altering it in our repo
import cv2
diff --git a/freemocap/fmc_openpose.py b/freemocap/fmc_openpose.py
index cc387cd3..429838d7 100644
--- a/freemocap/fmc_openpose.py
+++ b/freemocap/fmc_openpose.py
@@ -117,7 +117,7 @@ def parseOpenPose(session):
## %%
## load in data from json files
#numFrames = int(len(list(Path(session.openPose_jsonPathList[0]).glob('*')))) #lol
- numFrames = session.numFrames
+ numFrames = int(session.numFrames)
numMarkers= int(int(len(dataFrameHeader)/3))
numCams = int(session.numCams) #rebuilding numCams here instead of using session.numCams in case
diff --git a/freemocap/fmc_pyqtgraph.py b/freemocap/fmc_pyqtgraph.py
index 4e047438..f4fff34c 100644
--- a/freemocap/fmc_pyqtgraph.py
+++ b/freemocap/fmc_pyqtgraph.py
@@ -9,7 +9,7 @@ import numpy as np
from pathlib import Path
import sys
-
+
class PlaySkeletonWidget:
def __init__(self, session):
diff --git a/freemocap/fmc_runme.py b/freemocap/fmc_runme.py
index b2da863b..80120afd 100644
--- a/freemocap/fmc_runme.py
+++ b/freemocap/fmc_runme.py
@@ -163,8 +163,9 @@ def RunMe(sessionID=None,
if sesh.numFrames is None:
a_sync_vid_path = list(sesh.syncedVidPath.glob('*.mp4'))
- with cv2.VideoCapture(str(a_sync_vid_path[0])) as temp_cap:
- sesh.numFrames = temp_cap.get(cv2.CAP_PROP_FRAME_COUNT)
+ temp_cap = cv2.VideoCapture(str(a_sync_vid_path[0]))
+ sesh.numFrames = temp_cap.get(cv2.CAP_PROP_FRAME_COUNT)
+ temp_cap.release()
sesh.cgroup, sesh.mean_charuco_fr_mar_xyz = calibrate.CalibrateCaptureVolume(sesh,board, calVideoFrameLength)
@@ -224,11 +225,11 @@ def RunMe(sessionID=None,
if runMediaPipe:
fmc_mediapipe.runMediaPipe(sesh)
-
- sesh.mediaPipeData_nCams_nFrames_nImgPts_XYC = fmc_mediapipe.parseMediaPipe(sesh)
- sesh.mediaPipeSkel_fr_mar_xyz, sesh.mediaPipeSkel_reprojErr = reconstruct3D.reconstruct3D(sesh,sesh.mediaPipeData_nCams_nFrames_nImgPts_XYC, confidenceThreshold=reconstructionConfidenceThreshold)
- np.save(sesh.dataArrayPath/'mediaPipeSkel_3d.npy', sesh.mediaPipeSkel_fr_mar_xyz) #save data to npy
- np.save(sesh.dataArrayPath/'mediaPipeSkel_reprojErr.npy', sesh.mediaPipeSkel_reprojErr) #save data to npy
+ sesh.mediaPipeData_nCams_nFrames_nImgPts_XYC = fmc_mediapipe.parseMediaPipe(sesh)
+ sesh.mediaPipeSkel_fr_mar_xyz, sesh.mediaPipeSkel_reprojErr = reconstruct3D.reconstruct3D(sesh,sesh.mediaPipeData_nCams_nFrames_nImgPts_XYC, confidenceThreshold=reconstructionConfidenceThreshold)
+ np.save(sesh.dataArrayPath/'mediaPipeSkel_3d.npy', sesh.mediaPipeSkel_fr_mar_xyz) #save data to npy
+ np.save(sesh.dataArrayPath/'mediaPipeSkel_reprojErr.npy', sesh.mediaPipeSkel_reprojErr) #save data to npy
+
sesh.save_session()
if sesh.useOpenPose:
diff --git a/freemocap/session.py b/freemocap/session.py
index 6653b7f7..eaf415f5 100644
--- a/freemocap/session.py
+++ b/freemocap/session.py
@@ -203,7 +203,7 @@ class Session: #self like "recording self"
temp_cap = cv2.VideoCapture(str(vid))
thisCamFrames = temp_cap.get(cv2.CAP_PROP_FRAME_COUNT)
frames_per_cam[str(vid)] = thisCamFrames
- temp_cap.release()
+ temp_cap.release()
frame_check = len(list(set(list(frames_per_cam.values())))) == 1 # using set() to remove duplicates and check for values count