tracker-native: Linux skeleton-render probe + script + full-body test image (validates pose pipeline headless)

This commit is contained in:
kinect-bot committed 2026-11-26 01:02:31 -05:00
1 parent 6c886ae328
commit 275b7e27c4
4 files changed
+46

No files matched your search

+7
View File
@@ -35,3 +35,10 @@ g++ -std=c++17 -O2 -Wall -Wextra \
-o "${HERE}/build/pipeline_probe" \
-L "${ORT}/lib" -lonnxruntime -Wl,-rpath,"${ORT}/lib"
echo "built ${HERE}/build/pipeline_probe"
g++ -std=c++17 -O2 -Wall -Wextra \
-I "${ORT}/include" -I "${HERE}/src" \
"${HERE}/src/pose_estimator.cpp" "${HERE}/src/skel_render_probe.cpp" \
-o "${HERE}/build/skel_render_probe" \
-L "${ORT}/lib" -lonnxruntime -Wl,-rpath,"${ORT}/lib"
echo "built ${HERE}/build/skel_render_probe"
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env python3
"""Render the tracker's pose skeleton (joints+bones) onto a test image.
Usage: build/skel_render_probe <rgb.bin> | this maps lm lines -> overlay PNG.
python3 scripts/render_skeleton.py <rgb.bin> <lm.txt> <out.png>
"""
import struct, sys
from PIL import Image, ImageDraw
rgb_bin, lm_txt, out = sys.argv[1], sys.argv[2], sys.argv[3]
f=open(rgb_bin,'rb'); w,h=struct.unpack('<ii',f.read(8)); img=Image.frombytes('RGB',(w,h),f.read(w*h*3))
d=ImageDraw.Draw(img); lm={}
for line in open(lm_txt):
p=line.split()
if p and p[0]=='lm': lm[int(p[1])]=(float(p[2]),float(p[3]),float(p[4]))
CONN=[(11,12),(11,13),(13,15),(12,14),(14,16),(11,23),(12,24),(23,24),(23,25),(25,27),(27,29),(29,31),(27,31),(24,26),(26,28),(28,30),(30,32),(28,32),(0,11),(0,12)]
for a,b in CONN:
if a in lm and b in lm:
vis=min(lm[a][2],lm[b][2])>0.5
d.line([lm[a][:2],lm[b][:2]],fill=(0,255,0) if vis else (130,130,130),width=4)
for i,(x,y,v) in lm.items():
if i<33: d.ellipse([x-5,y-5,x+5,y+5],fill=(0,255,0) if v>0.5 else (255,160,0),outline=(0,0,0))
img.save(out); print('wrote',out)
+18
View File
@@ -0,0 +1,18 @@
#include <cstdint>
#include <cstdio>
#include <fstream>
#include <vector>
#include "pose_estimator.h"
using namespace kinect_tracker;
int main(int argc, char** argv){
const char* model = "models/pose_landmarks_detector.onnx";
const char* path = argc>1?argv[1]:"/tmp/fullbody_rgb.bin";
std::ifstream f(path, std::ios::binary);
int32_t w=0,h=0; f.read((char*)&w,4); f.read((char*)&h,4);
std::vector<uint8_t> rgb((size_t)w*h*3); f.read((char*)rgb.data(), rgb.size());
PoseEstimator est(model);
PoseResult r = est.acquire(rgb.data(), w, h);
printf("presence %.4f %dx%d\n", r.presence, w, h);
for(int i=0;i<39;i++) printf("lm %d %.3f %.3f %.4f\n", i, r.image_xy[i*2], r.image_xy[i*2+1], r.visibility[i]);
return 0;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB