1
Kinect 도구 상자를 사용 중이므로 ReplaySkeletonFrames
의 목록이 있습니다. 이 목록에서 처음으로 추적되는 뼈대를 가져 와서 일부 속성을 수정합니다.Kinect 해골 개체를 다른 Kinect 해골 개체로 복사하는 방법
우리가 알고있는 것처럼 우리가 객체를 변경하면 원래 객체도 변경됩니다.
해골 사본을 만들어야합니다.
참고 : 내 프레임이 ReplaySkeletonFrame
이고 "일반"Kinect가 ReplayFrame
이 아니기 때문에 CopySkeletonDataTo()
을 사용할 수 없습니다.
속성별로 속성을 복사하는 자체 메서드를 만들려고했지만 일부 속성을 복사 할 수 없습니다. 봐 ...
public static Skeleton Clone(this Skeleton actualSkeleton)
{
if (actualSkeleton != null)
{
Skeleton newOne = new Skeleton();
// doesn't work - The property or indexer 'Microsoft.Kinect.SkeletonJoints'
// cannot be used in this context because the set accessor is inaccessible
newOne.Joints = actualSkeleton.Joints;
// doesn't work - The property or indexer 'Microsoft.Kinect.SkeletonJoints'
// cannot be used in this context because the set accessor is inaccessible
JointCollection jc = new JointCollection();
jc = actualSkeleton.Joints;
newOne.Joints = jc;
//...
}
return newOne;
}
어떻게 해결할 수 있습니까? 더 많은 검색과
은 이전에 내가 가로 질러 아래 링크를 보았지만'Skeleton'이 아직 직렬화 가능하면 발견하지 못했습니다. 이것은 기본적으로 똑같은 일을하지만 더 일반적인 방법으로 그렇게하므로 '해골'객체를 확장 할 필요가 없으며 반복해서 사용할 수 있습니다. http://stackoverflow.com/questions/78536/cloning-objects-in-c-sharp –
멋지다, 나는이 기술을 몰랐다. – Ewerton