Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
MasterArbeit
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
Kai Westerkamp
MasterArbeit
Commits
6813e21f
Commit
6813e21f
authored
Jul 04, 2017
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
..
parent
d5c9509f
Pipeline
#247
passed with stage
in 19 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
23 deletions
+47
-23
main.cpp
3_PointCloud/main.cpp
+47
-23
No files found.
3_PointCloud/main.cpp
View file @
6813e21f
...
@@ -156,6 +156,7 @@ void getRgbData(IMultiSourceFrame* frame, bool writFrameToFile) {
...
@@ -156,6 +156,7 @@ void getRgbData(IMultiSourceFrame* frame, bool writFrameToFile) {
*
fdest
++
=
rgbimage
[
4
*
idx
+
2
]
/
255.
f
;
*
fdest
++
=
rgbimage
[
4
*
idx
+
2
]
/
255.
f
;
if
(
writFrameToFile
)
{
if
(
writFrameToFile
)
{
//copy points with valid Color
snapshotPoints
.
push_back
(
framePositions
[
i
]);
snapshotPoints
.
push_back
(
framePositions
[
i
]);
snapshotColors
.
push_back
(
rgbimage
[
4
*
idx
+
0
]);
snapshotColors
.
push_back
(
rgbimage
[
4
*
idx
+
0
]);
...
@@ -185,27 +186,6 @@ void getKinectData(bool writeFrameInVector) {
...
@@ -185,27 +186,6 @@ void getKinectData(bool writeFrameInVector) {
getDepthData
(
frame
);
getDepthData
(
frame
);
getRgbData
(
frame
,
writeFrameInVector
);
getRgbData
(
frame
,
writeFrameInVector
);
if
(
writeFrameInVector
)
{
//get controler pos
//frame -> global
points
.
clear
();
colors
.
clear
();
points
.
reserve
(
points
.
capacity
()
+
width
*
height
);
colors
.
reserve
(
colors
.
capacity
()
+
width
*
height
*
3
);
for
(
int
i
=
0
;
i
<
snapshotPoints
.
size
();
i
++
)
{
points
.
push_back
(
*
currentControlerPos
*
snapshotPoints
[
i
]);
colors
.
push_back
(
snapshotColors
[
i
*
3
]);
colors
.
push_back
(
snapshotColors
[
i
*
3
+
1
]);
colors
.
push_back
(
snapshotColors
[
i
*
3
+
2
]);
}
}
glBindBuffer
(
GL_ARRAY_BUFFER
,
vboId
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
vboId
);
glBufferData
(
GL_ARRAY_BUFFER
,
width
*
height
*
3
*
sizeof
(
GLfloat
),
framePositions
,
GL_DYNAMIC_DRAW
);
glBufferData
(
GL_ARRAY_BUFFER
,
width
*
height
*
3
*
sizeof
(
GLfloat
),
framePositions
,
GL_DYNAMIC_DRAW
);
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
...
@@ -262,7 +242,24 @@ void rotateCamera() {
...
@@ -262,7 +242,24 @@ void rotateCamera() {
void
drawKinectData
()
{
void
drawKinectData
()
{
getKinectData
(
captureFrame
);
getKinectData
(
captureFrame
);
//add points to point cloud
if
(
captureFrame
)
{
//get controler pos
points
.
clear
();
colors
.
clear
();
points
.
reserve
(
points
.
capacity
()
+
width
*
height
);
colors
.
reserve
(
colors
.
capacity
()
+
width
*
height
*
3
);
for
(
int
i
=
0
;
i
<
snapshotPoints
.
size
();
i
++
)
{
points
.
push_back
(
*
currentControlerPos
*
snapshotPoints
[
i
]);
colors
.
push_back
(
snapshotColors
[
i
*
3
]);
colors
.
push_back
(
snapshotColors
[
i
*
3
+
1
]);
colors
.
push_back
(
snapshotColors
[
i
*
3
+
2
]);
}
}
captureFrame
=
false
;
captureFrame
=
false
;
if
(
writeFile
)
{
if
(
writeFile
)
{
writePointCloud
();
writePointCloud
();
writeFile
=
false
;
writeFile
=
false
;
...
@@ -340,14 +337,41 @@ int main(int argc, char* argv[]) {
...
@@ -340,14 +337,41 @@ int main(int argc, char* argv[]) {
glClearColor
(
0
,
0
,
0
,
0
);
glClearColor
(
0
,
0
,
0
,
0
);
glClearDepth
(
1.0
f
);
glClearDepth
(
1.0
f
);
snapshotPoints
.
clear
();
snapshotColors
.
clear
();
// Write color array for vertices
float
*
fdest
=
(
float
*
)
frameColors
;
float
*
fdest2
=
(
float
*
)
framePositions
;
for
(
int
j
=
0
;
j
<
height
;
j
++
)
{
for
(
int
i
=
0
;
i
<
width
;
i
++
)
{
*
fdest
++
=
1.0
*
i
/
width
;
*
fdest
++
=
1.0
*
j
/
height
;
*
fdest
++
=
0
;
snapshotPoints
.
push_back
(
glm
::
vec3
(
1.0
*
i
/
width
,
1.0
*
j
/
height
,
0
));
snapshotColors
.
push_back
(
1.0
*
i
/
width
*
255
);
snapshotColors
.
push_back
(
1.0
*
j
/
height
*
255
);
snapshotColors
.
push_back
(
0
);
*
fdest2
++
=
1.0
*
i
/
width
;
*
fdest2
++
=
1.0
*
j
/
height
;;
*
fdest2
++
=
0
;
}
}
// Set up array buffers
// Set up array buffers
const
int
dataSize
=
width
*
height
*
3
*
4
;
const
int
dataSize
=
width
*
height
*
3
*
4
;
glGenBuffers
(
1
,
&
vboId
);
glGenBuffers
(
1
,
&
vboId
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
vboId
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
vboId
);
glBufferData
(
GL_ARRAY_BUFFER
,
dataSize
,
0
,
GL_DYNAMIC_DRAW
);
glBufferData
(
GL_ARRAY_BUFFER
,
dataSize
,
framePositions
,
GL_DYNAMIC_DRAW
);
glGenBuffers
(
1
,
&
cboId
);
glGenBuffers
(
1
,
&
cboId
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
cboId
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
cboId
);
glBufferData
(
GL_ARRAY_BUFFER
,
dataSize
,
0
,
GL_DYNAMIC_DRAW
);
glBufferData
(
GL_ARRAY_BUFFER
,
dataSize
,
frameColors
,
GL_DYNAMIC_DRAW
);
// Camera setup
// Camera setup
...
...
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