이 페이지는 기계 번역을 사용하여 번역되었습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.
Kinect V1 스켈레탈 데이터에 Skeleton Viewer 사용
Kinect® for Windows®에 대한 수집을 수행하고 골격 데이터를 얻으면 이 뷰어에서 골격 관절을 볼 수 있습니다. 이 예제 함수는 이미지 위에 뼈대 관절 위치를 중첩하여 하나의 RGB 이미지를 표시합니다.
Acquire Image and Skeletal Data Using Kinect V1에 표시된 대로 Kinect 객체를 생성하고 이미지와 골격 데이터를 얻습니다.
skeletonViewer
함수를 사용하여 골격 데이터를 봅니다.이 코드에서
skeleton
는 Kinect 깊이 센서가 반환한 조인트 이미지 위치이고,image
는 스켈레톤 프레임에 해당하는 RGB 이미지입니다.nSkeleton
는 스켈레톤의 개수입니다.function [] = skeletonViewer(skeleton, image, nSkeleton)
이는 Kinect 어댑터에서 반환된 조인트의 순서입니다.
Hip_Center = 1; Spine = 2; Shoulder_Center = 3; Head = 4; Shoulder_Left = 5; Elbow_Left = 6; Wrist_Left = 7; Hand_Left = 8; Shoulder_Right = 9; Elbow_Right = 10; Wrist_Right = 11; Hand_Right = 12; Hip_Left = 13; Knee_Left = 14; Ankle_Left = 15; Foot_Left = 16; Hip_Right = 17; Knee_Right = 18; Ankle_Right = 19; Foot_Right = 20;
RGB 이미지를 보여줍니다.
imshow(image);
관절을 연결하기 위해 뼈대 연결 맵을 만듭니다.
SkeletonConnectionMap = [[1 2]; % Spine [2 3]; [3 4]; [3 5]; %Left Hand [5 6]; [6 7]; [7 8]; [3 9]; %Right Hand [9 10]; [10 11]; [11 12]; [1 17]; % Right Leg [17 18]; [18 19]; [19 20]; [1 13]; % Left Leg [13 14]; [14 15]; [15 16]];
RGB 이미지에 뼈대를 그립니다.
for i = 1:19 if nSkeleton > 0 X1 = [skeleton(SkeletonConnectionMap(i,1),1,1) skeleton(SkeletonConnectionMap(i,2),1,1)]; Y1 = [skeleton(SkeletonConnectionMap(i,1),2,1) skeleton(SkeletonConnectionMap(i,2),2,1)]; line(X1,Y1, 'LineWidth', 1.5, 'LineStyle', '-', 'Marker', '+', 'Color', 'r'); end if nSkeleton > 1 X2 = [skeleton(SkeletonConnectionMap(i,1),1,2) skeleton(SkeletonConnectionMap(i,2),1,2)]; Y2 = [skeleton(SkeletonConnectionMap(i,1),2,2) skeleton(SkeletonConnectionMap(i,2),2,2)]; line(X2,Y2, 'LineWidth', 1.5, 'LineStyle', '-', 'Marker', '+', 'Color', 'g'); end hold on; end hold off;
이 예시에 대해 시청자는 한 사람의 컬러 이미지와 그 이미지 위에 중첩된 골격 데이터를 포함하는 다음 내용을 보게 됩니다.