나는 kinect에서 초보자이며 matlab에 사용하고 싶습니다. 해골 데이터에서 조인트 각도 정보가 필요합니다. 가장 쉬운 방법은 무엇입니까? 감사합니다. .Kinect-Matlab : 관절 각도 정보 얻기
0
A
답변
0
3
나는 매트 실험실 좋은하지 오전 이미지 수집 도구 상자가 필요하지만, 비주얼 스튜디오와 C#을 사용하려고합니다. 이 코드를 추가 할 템플릿으로 마이크로 소프트 SDK's의 SkeletonBasics-WPF를 사용
public class Angles
{
public double AngleBetweenTwoVectors(Vector3D vectorA, Vector3D vectorB)
{
double dotProduct;
vectorA.Normalize();
vectorB.Normalize();
dotProduct = Vector3D.DotProduct(vectorA, vectorB);
return (double)Math.Acos(dotProduct)/Math.PI*180;
}
public byte[] GetVector(Skeleton skeleton)
{
Vector3D ShoulderCenter = new Vector3D(skeleton.Joints[JointType.ShoulderCenter].Position.X, skeleton.Joints[JointType.ShoulderCenter].Position.Y, skeleton.Joints[JointType.ShoulderCenter].Position.Z);
Vector3D RightShoulder = new Vector3D(skeleton.Joints[JointType.ShoulderRight].Position.X, skeleton.Joints[JointType.ShoulderRight].Position.Y, skeleton.Joints[JointType.ShoulderRight].Position.Z);
Vector3D LeftShoulder = new Vector3D(skeleton.Joints[JointType.ShoulderLeft].Position.X, skeleton.Joints[JointType.ShoulderLeft].Position.Y, skeleton.Joints[JointType.ShoulderLeft].Position.Z);
Vector3D RightElbow = new Vector3D(skeleton.Joints[JointType.ElbowRight].Position.X, skeleton.Joints[JointType.ElbowRight].Position.Y, skeleton.Joints[JointType.ElbowRight].Position.Z);
Vector3D LeftElbow = new Vector3D(skeleton.Joints[JointType.ElbowLeft].Position.X, skeleton.Joints[JointType.ElbowLeft].Position.Y, skeleton.Joints[JointType.ElbowLeft].Position.Z);
Vector3D RightWrist = new Vector3D(skeleton.Joints[JointType.WristRight].Position.X, skeleton.Joints[JointType.WristRight].Position.Y, skeleton.Joints[JointType.WristRight].Position.Z);
Vector3D LeftWrist = new Vector3D(skeleton.Joints[JointType.WristLeft].Position.X, skeleton.Joints[JointType.WristLeft].Position.Y, skeleton.Joints[JointType.WristLeft].Position.Z);
Vector3D UpVector = new Vector3D(0.0, 1.0, 0.0);
double AngleRightElbow = AngleBetweenTwoVectors(RightElbow - RightShoulder, RightElbow - RightWrist);
double AngleRightShoulder = AngleBetweenTwoVectors(UpVector, RightShoulder - RightElbow);
double AngleLeftElbow = AngleBetweenTwoVectors(LeftElbow - LeftShoulder, LeftElbow - LeftWrist);
double AngleLeftShoulder = AngleBetweenTwoVectors(UpVector, LeftShoulder - LeftElbow);
byte[] Angles = {Convert.ToByte(AngleRightElbow), Convert.ToByte(AngleRightShoulder),Convert.ToByte(AngleLeftElbow),Convert.ToByte(AngleLeftShoulder)};
return Angles;
}
}
는 상단이 삽입합니다. 여기에 GetVector()
메서드를 호출 : 당신이 볼 수 있듯이 내가 네 각도 (RS, LF, RE, LE)를 계산하고 같은
private void SensorSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{
Skeleton[] skeletons = new Skeleton[0];
using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
{
if (skeletonFrame != null)
{
skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
skeletonFrame.CopySkeletonDataTo(skeletons);
}
}
using (DrawingContext dc = this.drawingGroup.Open())
{
// Draw a transparent background to set the render size
dc.DrawRectangle(Brushes.Black, null, new Rect(0.0, 0.0, RenderWidth, RenderHeight));
if (skeletons.Length != 0)
{
foreach (Skeleton skel in skeletons)
{
RenderClippedEdges(skel, dc);
if (skel.TrackingState == SkeletonTrackingState.Tracked)
{
this.DrawBonesAndJoints(skel, dc);
Angles MyAngles = new Angles();
byte[] ReadyAngles = MyAngles.GetVector(skel);
RightElbow.Text = ReadyAngles[0].ToString();
RightShoulder.Text = ReadyAngles[1].ToString();
LeftElbow.Text = ReadyAngles[2].ToString();
LeftShoulder.Text = ReadyAngles[3].ToString();
byte[] SequenceStart = {255};
if (ArduinoPort.IsOpen)
{
ArduinoPort.Write(SequenceStart,0,1);
ArduinoPort.Write(ReadyAngles, 0, 4);
}
}
else if (skel.TrackingState == SkeletonTrackingState.PositionOnly)
{
dc.DrawEllipse(
this.centerPointBrush,
null,
this.SkeletonPointToScreen(skel.Position),
BodyCenterThickness,
BodyCenterThickness);
}
}
}
// prevent drawing outside of our render area
this.drawingGroup.ClipGeometry = new RectangleGeometry(new Rect(0.0, 0.0, RenderWidth, RenderHeight));
}
}
나는 4 텍스트 상자를 추가했습니다. 이 앵글은 내 .xaml 파일의 텍스트 상자로 전달됩니다. 나는 이것이 당신을 위해 일하기를 바랍니다.
관련 문제
- 1. 관절
- 2. 나타내는 정보 각도
- 3. 각도 목록 정보
- 4. 각도 별 기사 얻기
- 5. 얻기 배열 각도 세계에서
- 6. 각도 약속으로부터 데이터 얻기
- 7. 각도 기능의 응답을 얻기
- 8. RotateAnimation 현재 각도 얻기
- 9. 웹 페이지에서 정보 얻기
- 10. Windows에서 한자 정보 얻기
- 11. 데이터베이스 sqlite에서 정보 얻기
- 12. 2 테이블에서 정보 얻기
- 13. PFX 파일에서 정보 얻기
- 14. 다른 JComponents에서 정보 얻기
- 15. iOS에서 사용자 정보 얻기
- 16. 마더 보드 정보 얻기
- 17. .Net 글꼴 정보 얻기?
- 18. 네트워크 인터페이스 정보 얻기
- 19. iPhone 노출 정보 얻기
- 20. 얻기 정보 : 부동산 API
- 21. 파일 세부 정보 얻기
- 22. numpy dtype 정보 얻기
- 23. 맞춤 URL에서 정보 얻기
- 24. MySQL 데이터베이스에서 정보 얻기
- 25. 프로세스 메모리 정보 얻기
- 26. XML 정보 얻기
- 27. 시작에서 URL 정보 얻기
- 28. MySQL에서 정보 얻기
- 29. PHP 개체 정보 얻기
- 30. SciTE의 키보드에서 정보 얻기
이미지 획득 상자가 관절의 각도를 줄 것이라고 생각하지 않습니까? – s900n