working
This commit is contained in:
2
.idea/vcs.xml
generated
2
.idea/vcs.xml
generated
@ -2,7 +2,5 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/mmdetection" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/mmpose" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
112
.idea/workspace.xml
generated
112
.idea/workspace.xml
generated
@ -4,29 +4,11 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="441a4e7b-d6ce-44cb-92c5-2f22f1b1874f" name="Changes" comment="initial commit">
|
||||
<change afterPath="$PROJECT_DIR$/.gitattributes" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/calculate.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/draw.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/filter.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ploting.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/receive_images.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/receiver.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/sender.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/utils.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/video_methods.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/JustTwerk.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/JustTwerk.iml" afterDir="false" />
|
||||
<list default="true" id="441a4e7b-d6ce-44cb-92c5-2f22f1b1874f" name="Changes" comment="working">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/02_whole_body_from_image.py" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/body3d.py" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/hrnet_w48_coco_256x192-b9e0b3ab_20200708.pth" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/humanPoseDetection.ipynb" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/rtmdet_m_8xb32-100e_coco-obj365-person-235e8209.pth" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/rtmpose-m_simcc-body7_pt-body7_420e-256x192-e48f03d0_20230504.pth" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/test.py" beforeDir="false" afterPath="$PROJECT_DIR$/test.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/videopose_h36m_243frames_fullconv_supervised_cpn_ft-88f5abbb_20210527.pth" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/utils.py" beforeDir="false" afterPath="$PROJECT_DIR$/utils.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -52,45 +34,46 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||
"Python.02_whole_body_from_image.executor": "Run",
|
||||
"Python.3d.executor": "Run",
|
||||
"Python.body3d.executor": "Run",
|
||||
"Python.body3d_pose_lifter_demo.executor": "Run",
|
||||
"Python.calculate.executor": "Run",
|
||||
"Python.checkpoint.executor": "Run",
|
||||
"Python.draw.executor": "Run",
|
||||
"Python.filter.executor": "Run",
|
||||
"Python.is_torch.executor": "Run",
|
||||
"Python.local_visualizer_3d.executor": "Run",
|
||||
"Python.openpose.executor": "Run",
|
||||
"Python.receive_images.executor": "Run",
|
||||
"Python.receiver.executor": "Run",
|
||||
"Python.sender.executor": "Run",
|
||||
"Python.test.executor": "Run",
|
||||
"Python.ultralytics-test.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "C:/Users/Kajetan/PycharmProjects/JustTwerk",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "configurable.group.editor",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||
"Python.02_whole_body_from_image.executor": "Run",
|
||||
"Python.3d.executor": "Run",
|
||||
"Python.body3d.executor": "Run",
|
||||
"Python.body3d_pose_lifter_demo.executor": "Run",
|
||||
"Python.calculate.executor": "Run",
|
||||
"Python.checkpoint.executor": "Run",
|
||||
"Python.draw.executor": "Run",
|
||||
"Python.filter.executor": "Run",
|
||||
"Python.is_torch.executor": "Run",
|
||||
"Python.local_visualizer_3d.executor": "Run",
|
||||
"Python.main.executor": "Run",
|
||||
"Python.openpose.executor": "Run",
|
||||
"Python.receive_images.executor": "Run",
|
||||
"Python.receiver.executor": "Run",
|
||||
"Python.sender.executor": "Run",
|
||||
"Python.test.executor": "Run",
|
||||
"Python.ultralytics-test.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "C:/Users/Kajetan/PycharmProjects/JustTwerk",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "configurable.group.editor",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\Kajetan\PycharmProjects\JustTwerk" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<component name="RunManager" selected="Python.draw">
|
||||
<configuration name="draw" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="JustTwerk" />
|
||||
<option name="ENV_FILES" value="" />
|
||||
@ -166,7 +149,10 @@
|
||||
<workItem from="1755891319108" duration="33842000" />
|
||||
<workItem from="1755974689137" duration="258000" />
|
||||
<workItem from="1755974961407" duration="19035000" />
|
||||
<workItem from="1756053672258" duration="10010000" />
|
||||
<workItem from="1756053672258" duration="16821000" />
|
||||
<workItem from="1756216787734" duration="969000" />
|
||||
<workItem from="1756632365037" duration="26000" />
|
||||
<workItem from="1757522631129" duration="1771000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="initial commit">
|
||||
<option name="closed" value="true" />
|
||||
@ -176,7 +162,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1755963464017</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<task id="LOCAL-00002" summary="working">
|
||||
<option name="closed" value="true" />
|
||||
<created>1756143470328</created>
|
||||
<option name="number" value="00002" />
|
||||
<option name="presentableId" value="LOCAL-00002" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1756143470328</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="3" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@ -184,9 +178,11 @@
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="initial commit" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="initial commit" />
|
||||
<MESSAGE value="working" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="working" />
|
||||
</component>
|
||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||
<SUITE FILE_PATH="coverage/JustTwerk$main.coverage" NAME="main Coverage Results" MODIFIED="1756143599014" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/JustTwerk$receiver.coverage" NAME="receiver Coverage Results" MODIFIED="1756142451233" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/JustTwerk$filter.coverage" NAME="filter Coverage Results" MODIFIED="1755972211046" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/JustTwerk$body3d_pose_lifter_demo.coverage" NAME="body3d_pose_lifter_demo Coverage Results" MODIFIED="1755937235510" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/mmpose/demo" />
|
||||
|
||||
244
main.py
244
main.py
@ -1,52 +1,23 @@
|
||||
import pickle
|
||||
import sys
|
||||
|
||||
import regex as re
|
||||
import numpy as np
|
||||
from ultralytics import YOLO
|
||||
import cv2
|
||||
import time
|
||||
|
||||
from calculate import normalize_pose, compare_poses_boolean
|
||||
from draw import draw_new
|
||||
from video_methods import initialize_method
|
||||
|
||||
model = YOLO("yolo11x-pose.pt")
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
method = sys.argv[1]
|
||||
if len(sys.argv) == 2:
|
||||
method_type = sys.argv[1]
|
||||
else:
|
||||
print("Podaj argument 'cam', albo 'network'.")
|
||||
print("Podaj argument 'cam', albo 'net'.")
|
||||
exit(1)
|
||||
|
||||
cap = cv2.VideoCapture(0)
|
||||
|
||||
if not cap.isOpened():
|
||||
print("Nie można otworzyć kamerki")
|
||||
exit(1)
|
||||
|
||||
last_time = time.time()
|
||||
|
||||
|
||||
startTime = time.time()
|
||||
stage = 0
|
||||
|
||||
pose = normalize_pose(np.array([[ 353.17, 107.28],
|
||||
[ 363.3, 96.435],
|
||||
[ 347.1, 98.647],
|
||||
[ 390.12, 99.096],
|
||||
[ 346.09, 103.63],
|
||||
[ 425.77, 149.95],
|
||||
[ 327.92, 153.12],
|
||||
[ 495.16, 169.82],
|
||||
[ 260.86, 166.3],
|
||||
[ 565.53, 182.68],
|
||||
[ 192.34, 170.58],
|
||||
[ 393.83, 316.99],
|
||||
[ 337.05, 316.41],
|
||||
[ 388.36, 433.37],
|
||||
[ 333.88, 431.89],
|
||||
[ 383.58, 479.16],
|
||||
[ 330.89, 480]]))
|
||||
method = initialize_method(method_type)
|
||||
|
||||
do_pose_shot = False
|
||||
|
||||
@ -56,149 +27,126 @@ def click_event(event, x, y, flags, param):
|
||||
if event == cv2.EVENT_LBUTTONDOWN: # lewy przycisk myszy
|
||||
do_pose_shot = not do_pose_shot
|
||||
|
||||
currTimeIndex = 0
|
||||
currIndex = None
|
||||
currMove = None
|
||||
currStatus = "Zacznij tanczyc"
|
||||
def main():
|
||||
last_time = time.time()
|
||||
|
||||
mehCount = 0
|
||||
goodCount = 0
|
||||
failCount = 0
|
||||
failRate = 2
|
||||
currTimeIndex = 0
|
||||
currIndex = None
|
||||
currMove = None
|
||||
currStatus = "Zacznij tanczyc"
|
||||
|
||||
def wczytaj_dane_z_txt(sciezka):
|
||||
wynik = []
|
||||
with open(sciezka, "r") as f:
|
||||
zawartosc = f.read()
|
||||
mehCount = 0
|
||||
goodCount = 0
|
||||
failCount = 0
|
||||
failRate = 2
|
||||
|
||||
# Znajdź wszystkie krotki w formacie (float, array([...]))
|
||||
pattern = re.compile(r"\(([^,]+),\s*array\((\[.*?\]),\s*dtype=float32\)\)")
|
||||
matches = pattern.findall(zawartosc)
|
||||
moves = []
|
||||
|
||||
for m in matches:
|
||||
liczba = float(m[0])
|
||||
tablica = np.array(eval(m[1]), dtype=np.float32)
|
||||
wynik.append((liczba, tablica))
|
||||
with open('moves.pkl', 'rb') as f: # 'rb' = read binary
|
||||
moves = pickle.load(f)
|
||||
|
||||
return wynik
|
||||
startValue = moves[0][0]
|
||||
totalCount = len(moves)
|
||||
|
||||
moves = []
|
||||
for i, move in enumerate(moves):
|
||||
moves[i] = (move[0] - startValue, move[1], move[2])
|
||||
|
||||
with open('moves.pkl', 'rb') as f: # 'rb' = read binary
|
||||
moves = pickle.load(f)
|
||||
while True:
|
||||
frame = method.receive_frame()
|
||||
|
||||
startValue = moves[0][0]
|
||||
totalCount = len(moves)
|
||||
frame = cv2.flip(frame, 1)
|
||||
|
||||
for i, move in enumerate(moves):
|
||||
moves[i] = (move[0] - startValue, move[1], move[2])
|
||||
results = model(frame, verbose=False)
|
||||
|
||||
def find_closest(target):
|
||||
global moves
|
||||
return min(moves, key=lambda t: abs(t[0] - target))
|
||||
current_time = time.time()
|
||||
delta = current_time - last_time
|
||||
last_time = current_time
|
||||
|
||||
while True:
|
||||
ret, frame = cap.read()
|
||||
frame = cv2.flip(frame, 1)
|
||||
fps = 1 / delta if delta > 0 else float('inf')
|
||||
# print(f"\rDelta: {delta:.4f}s, FPS: {fps:.2f}", end="")
|
||||
|
||||
results = model(frame, verbose=False)
|
||||
for result in results:
|
||||
kpts = result.keypoints.data[0] if len(result.keypoints.data) else None
|
||||
|
||||
current_time = time.time()
|
||||
delta = current_time - last_time
|
||||
last_time = current_time
|
||||
if kpts is None:
|
||||
continue
|
||||
|
||||
fps = 1 / delta if delta > 0 else float('inf')
|
||||
# print(f"\rDelta: {delta:.4f}s, FPS: {fps:.2f}", end="")
|
||||
img = frame
|
||||
|
||||
for result in results:
|
||||
kpts = result.keypoints.data[0] if len(result.keypoints.data) else None
|
||||
normalized = normalize_pose(result.keypoints.xy.cpu().numpy()[0])
|
||||
cv2.imshow('you', draw_new(result.keypoints.xy.cpu()[0]))
|
||||
|
||||
if kpts is None:
|
||||
continue
|
||||
if currTimeIndex != 0 and moves.index(find_closest(time.time() - currTimeIndex)) == len(moves) - 1:
|
||||
mehCount = totalCount - failCount - goodCount
|
||||
|
||||
img = frame
|
||||
print(
|
||||
f"PODSUMOWANIE: FAIL {failCount} MEH: {mehCount} PERFECT: {goodCount} PERCENTAGE: {(goodCount + (0.95 * mehCount)) / totalCount * 100}%")
|
||||
exit(1)
|
||||
|
||||
normalized = normalize_pose(result.keypoints.xy.cpu().numpy()[0])
|
||||
cv2.imshow('you', draw_new(result.keypoints.xy.cpu()[0]))
|
||||
if currMove is None:
|
||||
if compare_poses_boolean(moves[0][1], normalized):
|
||||
currIndex = 1
|
||||
currTimeIndex = time.time()
|
||||
deltaTime = time.time()
|
||||
currStatus = f"Zaczoles tanczyc {currIndex}"
|
||||
currMove = moves[0]
|
||||
|
||||
if currTimeIndex != 0 and moves.index(find_closest(time.time() - currTimeIndex)) == len(moves) - 1:
|
||||
mehCount = totalCount - failCount - goodCount
|
||||
# thread = Thread(target=print_animation, args=(moves, False))
|
||||
# thread.start()
|
||||
else:
|
||||
changed = False
|
||||
|
||||
print(f"PODSUMOWANIE: FAIL {failCount} MEH: {mehCount} PERFECT: {goodCount} PERCENTAGE: {(goodCount + (0.95 * mehCount)) / totalCount * 100}%")
|
||||
exit(1)
|
||||
closest = find_closest(time.time() - currTimeIndex)
|
||||
cv2.imshow('Dots', draw_new(closest[2]))
|
||||
|
||||
if currMove is None:
|
||||
if compare_poses_boolean(moves[0][1], normalized):
|
||||
currIndex = 1
|
||||
currTimeIndex = time.time()
|
||||
deltaTime = time.time()
|
||||
currStatus = f"Zaczoles tanczyc {currIndex}"
|
||||
currMove = moves[0]
|
||||
if abs((time.time() - currTimeIndex) - moves[currIndex][0]) > failRate:
|
||||
currStatus = f"FAIL!"
|
||||
failCount += 1
|
||||
|
||||
# thread = Thread(target=print_animation, args=(moves, False))
|
||||
# thread.start()
|
||||
else:
|
||||
changed = False
|
||||
if compare_poses_boolean(closest[1], normalized):
|
||||
# delays += (time.time() - deltaTime - moves[0][0]) * 1000
|
||||
# delaysCount += 1
|
||||
|
||||
closest = find_closest(time.time() - currTimeIndex)
|
||||
cv2.imshow('Dots', draw_new(closest[2]))
|
||||
currStatus = f"SUPER! {currIndex} Zostalo {len(moves)} Delay {(time.time() - currTimeIndex - closest[0]) / 1000}ms"
|
||||
deltaTime = time.time()
|
||||
|
||||
if abs((time.time() - currTimeIndex) - moves[currIndex][0]) > failRate:
|
||||
currStatus = f"FAIL!"
|
||||
failCount += 1
|
||||
currIndex = moves.index(closest) + 1
|
||||
goodCount += 1
|
||||
changed = True
|
||||
|
||||
if compare_poses_boolean(closest[1], normalized):
|
||||
# delays += (time.time() - deltaTime - moves[0][0]) * 1000
|
||||
# delaysCount += 1
|
||||
if not changed and compare_poses_boolean(moves[currIndex][1], normalized):
|
||||
# delays += (time.time() - deltaTime - moves[0][0]) * 1000
|
||||
# delaysCount += 1
|
||||
|
||||
currStatus = f"SUPER! {currIndex} Zostalo {len(moves)} Delay {(time.time() - currTimeIndex - closest[0]) / 1000}ms"
|
||||
deltaTime = time.time()
|
||||
currStatus = f"SUPER! {currIndex} Zostalo {len(moves)} Delay {(time.time() - currTimeIndex - closest[0]) / 1000}ms"
|
||||
deltaTime = time.time()
|
||||
|
||||
currIndex = moves.index(closest) + 1
|
||||
goodCount += 1
|
||||
changed = True
|
||||
changed = True
|
||||
|
||||
if not changed and compare_poses_boolean(moves[currIndex][1], normalized):
|
||||
# delays += (time.time() - deltaTime - moves[0][0]) * 1000
|
||||
# delaysCount += 1
|
||||
currIndex += 1
|
||||
goodCount += 1
|
||||
|
||||
currStatus = f"SUPER! {currIndex} Zostalo {len(moves)} Delay {(time.time() - currTimeIndex - closest[0]) / 1000}ms"
|
||||
deltaTime = time.time()
|
||||
# if do_pose_shot:
|
||||
# moves.append((time.time() - startTime, normalize_pose(result.keypoints.xy.cpu().numpy()[0]), result.keypoints.xy.cpu()[0]))
|
||||
# elif len(moves) != 0:
|
||||
# with open('moves.pkl', 'wb') as f: # 'wb' = write binary
|
||||
# pickle.dump(moves, f)
|
||||
#
|
||||
# exit(1)
|
||||
|
||||
changed = True
|
||||
cv2.putText(
|
||||
img, # obraz
|
||||
currStatus, # tekst
|
||||
(50, 100), # pozycja (x, y) lewego dolnego rogu tekstu
|
||||
cv2.FONT_HERSHEY_SIMPLEX, # czcionka
|
||||
1, # rozmiar (skalowanie)
|
||||
(0, 0, 255), # kolor (BGR) - tutaj czerwony
|
||||
2, # grubość linii
|
||||
cv2.LINE_AA # typ antyaliasingu
|
||||
)
|
||||
|
||||
currIndex += 1
|
||||
goodCount += 1
|
||||
cv2.imshow('Klatka z kamerki', img)
|
||||
cv2.setMouseCallback('Klatka z kamerki', click_event)
|
||||
cv2.waitKey(1) # Czekaj na naciśnięcie klawisza
|
||||
|
||||
# if do_pose_shot:
|
||||
# moves.append((time.time() - startTime, normalize_pose(result.keypoints.xy.cpu().numpy()[0]), result.keypoints.xy.cpu()[0]))
|
||||
# elif len(moves) != 0:
|
||||
# with open('moves.pkl', 'wb') as f: # 'wb' = write binary
|
||||
# pickle.dump(moves, f)
|
||||
#
|
||||
# exit(1)
|
||||
|
||||
cv2.putText(
|
||||
img, # obraz
|
||||
currStatus, # tekst
|
||||
(50, 100), # pozycja (x, y) lewego dolnego rogu tekstu
|
||||
cv2.FONT_HERSHEY_SIMPLEX, # czcionka
|
||||
1, # rozmiar (skalowanie)
|
||||
(0, 0, 255), # kolor (BGR) - tutaj czerwony
|
||||
2, # grubość linii
|
||||
cv2.LINE_AA # typ antyaliasingu
|
||||
)
|
||||
|
||||
cv2.imshow('Klatka z kamerki', img)
|
||||
cv2.setMouseCallback('Klatka z kamerki', click_event)
|
||||
cv2.waitKey(1) # Czekaj na naciśnięcie klawisza
|
||||
|
||||
|
||||
# Access the results
|
||||
for result in results:
|
||||
annotated_frame = result.plot() # zwraca obraz z naniesionymi keypoints
|
||||
|
||||
# Wyświetlenie obrazu przy użyciu OpenCV
|
||||
cv2.imshow("Pose", annotated_frame)
|
||||
cv2.waitKey(0)
|
||||
cv2.destroyAllWindows()
|
||||
main()
|
||||
Reference in New Issue
Block a user