Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
ButtonPusher
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Button Pusher
ButtonPusher
Commits
a38f2b6c
Commit
a38f2b6c
authored
Jan 29, 2018
by
16이상민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed an issue that prevented importing Kinect Frame
parent
ed3a1d8e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
179 additions
and
106 deletions
+179
-106
KinectAccessManagerTests.cs
Assets/Editor/KinectAccessManagerTests.cs
+1
-1
SourceBufferTests.cs
Assets/Editor/SourceBufferTests.cs
+1
-1
GreenScreen.mat
Assets/Resources/GreenScreen/GreenScreen.mat
+1
-1
tmp.unity
Assets/Scene/tmp.unity
+39
-7
CoordinateMapperManager.cs
Assets/Script/CoordinateMapperManager.cs
+135
-96
GraphicsSettings.asset
ProjectSettings/GraphicsSettings.asset
+2
-0
No files found.
Assets/Editor/KinectAccessManagerTests.cs
View file @
a38f2b6c
using
NUnit.Framework
;
using
KinectModule
;
using
Windows.Kinect
;
using
KinectModule
;
public
class
KinectAccessManagerTests
{
...
...
Assets/Editor/SourceBufferTests.cs
View file @
a38f2b6c
using
NUnit.Framework
;
using
Windows.Kinect
;
using
KinectModule
;
using
System.Linq
;
using
System
;
using
System.Collections.Generic
;
using
KinectModule
;
// To test the update function and the updated buffer, you need a stub for the source frame class.
...
...
Assets/Resources/GreenScreen/GreenScreen.mat
View file @
a38f2b6c
...
...
@@ -37,4 +37,4 @@ Material:
m_Floats
:
-
_Cutoff
:
0
m_Colors
:
-
_Color
:
{
r
:
0
,
g
:
1
,
b
:
0
,
a
:
1
}
-
_Color
:
{
r
:
0
,
g
:
1
,
b
:
0
,
a
:
0
}
Assets/Scene/tmp.unity
View file @
a38f2b6c
...
...
@@ -187,9 +187,8 @@ GameObject:
m_Component
:
-
component
:
{
fileID
:
750753103
}
-
component
:
{
fileID
:
750753108
}
-
component
:
{
fileID
:
750753104
}
m_Layer
:
5
m_Name
:
tmp
Managers
m_Name
:
InGame
Managers
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
...
...
@@ -213,7 +212,7 @@ RectTransform:
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!114
&75075310
4
---
!u!114
&75075310
8
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
...
...
@@ -221,21 +220,54 @@ MonoBehaviour:
m_GameObject
:
{
fileID
:
750753102
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
a9d22e7eb4921ca47b18c68e43c0eb6e
,
type
:
3
}
m_Script
:
{
fileID
:
11500000
,
guid
:
397b5aecede4d754abd2fba781e08f97
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
defaultSound
:
{
fileID
:
0
}
---
!u!114
&750753108
---
!u!1
&1026530465
GameObject
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
1026530467
}
-
component
:
{
fileID
:
1026530466
}
m_Layer
:
5
m_Name
:
GameManager
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&1026530466
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
750753102
}
m_GameObject
:
{
fileID
:
1026530465
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
397b5aecede4d754abd2fba781e08f97
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!224
&1026530467
RectTransform
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1026530465
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
4
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!1
&1217935565
GameObject
:
m_ObjectHideFlags
:
0
...
...
Assets/Script/CoordinateMapperManager.cs
View file @
a38f2b6c
...
...
@@ -131,14 +131,14 @@ namespace KinectModule
public
class
SourceBuffer
{
private
byte
[]
_ColorBuffer
=
new
byte
[
KinectConstants
.
ColorWidth
*
private
byte
[]
_ColorBuffer
=
new
byte
[
KinectConstants
.
ColorWidth
*
KinectConstants
.
ColorHeight
*
KinectConstants
.
ColorCount
],
_BodyIndexBuffer
=
new
byte
[
KinectConstants
.
DepthWidth
*
_BodyIndexBuffer
=
new
byte
[
KinectConstants
.
DepthWidth
*
KinectConstants
.
DepthHeight
];
private
ushort
[]
_DepthBuffer
=
new
ushort
[
KinectConstants
.
DepthWidth
*
KinectConstants
.
DepthHeight
];
private
IBody
[]
_BodyBuffer
=
new
IBody
[
KinectConstants
.
BodyCount
];
private
IBody
[]
_BodyBuffer
=
new
IBody
[
KinectConstants
.
BodyCount
];
public
byte
[]
ColorBuffer
{
get
{
return
_ColorBuffer
;
}
}
...
...
@@ -326,89 +326,123 @@ namespace KinectModule
public
RealMultiSourceFrame
(
MultiSourceFrame
sourceFrame
)
{
_ColorFrame
=
new
RealColorFrame
(
sourceFrame
==
null
?
null
:
sourceFrame
.
ColorFrameReference
.
AcquireFrame
());
_BodyIndexFrame
=
new
RealBodyIndexFrame
(
sourceFrame
==
null
?
null
:
sourceFrame
.
BodyIndexFrameReference
.
AcquireFrame
());
_DepthFrame
=
new
RealDepthFrame
(
sourceFrame
==
null
?
null
:
sourceFrame
.
DepthFrameReference
.
AcquireFrame
());
_BodyFrame
=
new
RealBodyFrame
(
sourceFrame
==
null
?
null
:
sourceFrame
.
BodyFrameReference
.
AcquireFrame
());
if
(
sourceFrame
==
null
)
{
_ColorFrame
=
new
RealColorFrame
(
null
);
_BodyIndexFrame
=
new
RealBodyIndexFrame
(
null
);
_DepthFrame
=
new
RealDepthFrame
(
null
);
_BodyFrame
=
new
RealBodyFrame
(
null
);
return
;
}
using
(
var
colorFrame
=
sourceFrame
.
ColorFrameReference
.
AcquireFrame
())
_ColorFrame
=
new
RealColorFrame
(
colorFrame
);
using
(
var
bodyIndexFrame
=
sourceFrame
.
BodyIndexFrameReference
.
AcquireFrame
())
_BodyIndexFrame
=
new
RealBodyIndexFrame
(
bodyIndexFrame
);
using
(
var
depthFrame
=
sourceFrame
.
DepthFrameReference
.
AcquireFrame
())
_DepthFrame
=
new
RealDepthFrame
(
depthFrame
);
using
(
var
bodyFrame
=
sourceFrame
.
BodyFrameReference
.
AcquireFrame
())
_BodyFrame
=
new
RealBodyFrame
(
bodyFrame
);
}
private
class
RealColorFrame
:
IColorFrame
{
private
ColorFrame
_Frame
;
private
byte
[]
_Buffer
=
new
byte
[
KinectConstants
.
ColorWidth
*
KinectConstants
.
ColorHeight
*
KinectConstants
.
ColorCount
];
private
bool
IsValid
=
false
;
public
RealColorFrame
(
ColorFrame
frame
)
{
_Frame
=
frame
;
if
(
frame
!=
null
)
{
var
ColorData
=
GCHandle
.
Alloc
(
_Buffer
,
GCHandleType
.
Pinned
);
frame
.
CopyConvertedFrameDataToIntPtr
(
ColorData
.
AddrOfPinnedObject
(),
(
uint
)
_Buffer
.
Length
,
ColorImageFormat
.
Rgba
);
ColorData
.
Free
();
IsValid
=
true
;
}
}
public
void
CopyData
(
byte
[]
buffer
)
{
if
(
_Frame
!=
null
)
{
var
ColorData
=
GCHandle
.
Alloc
(
buffer
,
GCHandleType
.
Pinned
);
_Frame
.
CopyConvertedFrameDataToIntPtr
(
ColorData
.
AddrOfPinnedObject
(),
(
uint
)
buffer
.
Length
,
ColorImageFormat
.
Rgba
);
ColorData
.
Free
();
}
if
(
IsValid
)
Array
.
Copy
(
_Buffer
,
buffer
,
_Buffer
.
Length
);
}
}
private
class
RealBodyIndexFrame
:
IBodyIndexFrame
{
private
BodyIndexFrame
_Frame
;
private
byte
[]
_Buffer
=
new
byte
[
KinectConstants
.
DepthWidth
*
KinectConstants
.
DepthHeight
];
private
bool
IsValid
=
false
;
public
RealBodyIndexFrame
(
BodyIndexFrame
frame
)
{
_Frame
=
frame
;
if
(
frame
!=
null
)
{
var
BodyIndexData
=
GCHandle
.
Alloc
(
_Buffer
,
GCHandleType
.
Pinned
);
frame
.
CopyFrameDataToIntPtr
(
BodyIndexData
.
AddrOfPinnedObject
(),
(
uint
)
_Buffer
.
Length
);
BodyIndexData
.
Free
();
IsValid
=
true
;
}
}
public
void
CopyData
(
byte
[]
buffer
)
{
if
(
_Frame
!=
null
)
{
var
BodyIndexData
=
GCHandle
.
Alloc
(
buffer
,
GCHandleType
.
Pinned
);
_Frame
.
CopyFrameDataToIntPtr
(
BodyIndexData
.
AddrOfPinnedObject
(),
(
uint
)
buffer
.
Length
);
BodyIndexData
.
Free
();
}
if
(
IsValid
)
Array
.
Copy
(
_Buffer
,
buffer
,
_Buffer
.
Length
);
}
}
private
class
RealDepthFrame
:
IDepthFrame
{
private
DepthFrame
_Frame
;
private
ushort
[]
_Buffer
=
new
ushort
[
KinectConstants
.
DepthWidth
*
KinectConstants
.
DepthHeight
];
private
bool
IsValid
=
false
;
public
RealDepthFrame
(
DepthFrame
frame
)
{
_Frame
=
frame
;
if
(
frame
!=
null
)
{
var
DepthData
=
GCHandle
.
Alloc
(
_Buffer
,
GCHandleType
.
Pinned
);
frame
.
CopyFrameDataToIntPtr
(
DepthData
.
AddrOfPinnedObject
(),
(
uint
)
_Buffer
.
Length
*
sizeof
(
ushort
));
DepthData
.
Free
();
IsValid
=
true
;
}
}
public
void
CopyData
(
ushort
[]
buffer
)
{
if
(
_Frame
!=
null
)
{
var
DepthData
=
GCHandle
.
Alloc
(
buffer
,
GCHandleType
.
Pinned
);
_Frame
.
CopyFrameDataToIntPtr
(
DepthData
.
AddrOfPinnedObject
(),
(
uint
)
buffer
.
Length
*
sizeof
(
ushort
));
DepthData
.
Free
();
}
if
(
IsValid
)
Array
.
Copy
(
_Buffer
,
buffer
,
_Buffer
.
Length
);
}
}
private
class
RealBodyFrame
:
IBodyFrame
{
private
BodyFrame
_Frame
;
private
Body
[]
_Buffer
=
new
Body
[
KinectConstants
.
BodyCount
];
private
bool
IsValid
=
false
;
public
RealBodyFrame
(
BodyFrame
frame
)
{
_Frame
=
frame
;
if
(
frame
!=
null
)
{
frame
.
GetAndRefreshBodyData
(
_Buffer
);
IsValid
=
true
;
}
}
public
void
CopyData
(
IBody
[]
buffer
)
{
if
(
_Frame
!=
null
)
_Frame
.
GetAndRefreshBodyData
(
buffer
.
Select
(
x
=>
(
x
as
RealBody
).
Value
).
ToList
());
if
(
IsValid
)
Enumerable
.
Range
(
0
,
KinectConstants
.
BodyCount
)
.
ToList
()
.
ForEach
(
x
=>
buffer
[
x
]
=
new
RealBody
(
_Buffer
[
x
]));
}
}
}
...
...
@@ -420,9 +454,14 @@ namespace KinectModule
public
bool
IsTracked
{
get
{
return
_Body
.
IsTracked
;
}
}
public
Dictionary
<
JointType
,
IJoint
>
Joints
{
get
{
return
_Body
.
Joints
{
get
{
return
_Body
.
Joints
.
Select
(
x
=>
new
KeyValuePair
<
JointType
,
IJoint
>(
x
.
Key
,
new
RealJoint
(
x
.
Value
)))
.
ToDictionary
(
x
=>
x
.
Key
,
x
=>
x
.
Value
);
}
}
.
ToDictionary
(
x
=>
x
.
Key
,
x
=>
x
.
Value
);
}
}
public
Body
Value
{
get
{
return
_Body
;
}
}
...
...
ProjectSettings/GraphicsSettings.asset
View file @
a38f2b6c
...
...
@@ -35,6 +35,8 @@ GraphicsSettings:
-
{
fileID
:
15106
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
-
{
fileID
:
10753
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
-
{
fileID
:
10770
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
-
{
fileID
:
17000
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
-
{
fileID
:
16000
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_PreloadedShaders
:
[]
m_SpritesDefaultMaterial
:
{
fileID
:
10754
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment