资源简介
Kinect运用OpenNI产生点云
http://blog.csdn.net/opensource07/article/details/7804246

代码片段和文件信息
#include “DepthmapToPointCloud.h“
#include
#include
#include
#define TODEGREE 57.2957795 // radian->degree
#define PI 3.1415926
/**
* global variable
*/
xn::Context context;
xn::DepthGenerator dethGenerator;
DepthmapPointCloud cloud(context dethGenerator);
/**
* OpenGL drawing
*/
int h_rotate_angle=0 v_rotate_angle=0; // h: horizontal v: vertical
GLfloat cameraX=0.0f cameraY=0.0f cameraZ=0.0f; // 相机坐标位置
GLfloat h_rotate_radianh_sin_value h_cos_value; // 旋转角度、对应角度sin值与cos值
GLfloat v_rotate_radianv_sin_value v_cos_value;
const GLfloat origin_to_center = 2.5f; // 坐标原点到gluLookAt函数中视线点center的距离
GLfloat zoom_step = origin_to_center; // 缩放变量
void OpenGL_init(void)
{
glClearColor(0.0f 0.0f 0.0f 1.0f); // background color: white
glShadeModel(GL_FLAT);
glClear(GL_COLOR_BUFFER_BIT);
}
//////////////////////////////////////
void OpenGL_rending(void)
{
// GLshort r=0 g=0 b=0;
glColor3f(1.0f 1.0f 1.0f);
glPointSize(0.1f);
glBegin(GL_POINTS);
for (unsigned int i=0; i {
// if (cloud.getPointCloudData()[i].Z >=0.0f && cloud.getPointCloudData()[i].Z < 0.4f) { r=1.0f; g=1.0f; b=1.0f; } // 白色
// else if (cloud.getPointCloudData()[i].Z >= 0.4f && cloud.getPointCloudData()[i].Z < 0.8f) { r=0.0f; g=1.0f; b=1.0f; } // 青色
// else if (cloud.getPointCloudData()[i].Z >= 0.8f && cloud.getPointCloudData()[i].Z < 1.2f) { r=1.0f; g=0.0f; b=1.0f; } // 洋红
// else if (cloud.getPointCloudData()[i].Z >= 1.2f && cloud.getPointCloudData()[i].Z < 1.6f) { r=0.0f; g=0.75f; b=1.0f; } // 深天蓝
// else if (cloud.getPointCloudData()[i].Z >= 1.6f && cloud.getPointCloudData()[i].Z < 2.0f) { r=1.0f; g=0.27f; b=0.0f; } // 橙红
// else { r=0.0f; g=0.0f; b=0.0f; } // 黑色
// 深度图形式表示
// if (cloud.getPointCloudData()[i].Z >= 0.4)
// r = g = b = (int)((cloud.getPointCloudData()[i].Z-0.4)*100)>>1;
// else
// r = g = b = 255;
// glColor3b(r g b);
glVertex3f(cloud.getPointCloudData()[i].X cloud.getPointCloudData()[i].Y cloud.getPointCloudData()[i].Z);
}
glEnd();
cloud.updataPointCloud(); // update next frame cloudpoint data
glFlush();
glutSwapBuffers();
}
/////////////////////////////////////
void OpenGL_Idel()
{
OpenGL_rending(); // 刷新显示
glClear(GL_COLOR_BUFFER_BIT);
}
/////////////////////////////////////
void OpenGL_changeSize(int w int h)
{
glViewport(0 0 GLsizei(w) GLsizei(h));
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// if (w <= h) // 正交投影
// glOrtho(-2.0 2.0 -2.0*(GLfloat)h/(GLfloat)w 2.0*(GLfloat)h/(GLfloat)w -10.0 10.0);
// else
// glOrtho(-2.0*(GLfloat)w/(GLfloat)h 2.0*(GLfloat)w/(GLfloat)h -2.0 2.0 -10.0 10.0);
gluPerspective(60.0 (GLfloat)w/(GLfloat)h 0.1f 50.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(cameraX cameraY cameraZ 0.0f 0.0f 0.1f 0.0f 1.0f 0.0f);
}
////////////////////////////////////
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-10-17 10:24 DepthmapToPointCloud_OpenGL\
文件 948 2012-07-29 10:52 DepthmapToPointCloud_OpenGL.sln
文件 4095 2012-08-13 10:11 DepthmapToPointCloud_OpenGL\DepthmapToPointCloud.h
文件 3706 2012-07-30 08:39 DepthmapToPointCloud_OpenGL\DepthmapToPointCloud_OpenGL.vcxproj
文件 1088 2012-07-29 11:33 DepthmapToPointCloud_OpenGL\DepthmapToPointCloud_OpenGL.vcxproj.filters
文件 143 2012-07-29 10:52 DepthmapToPointCloud_OpenGL\DepthmapToPointCloud_OpenGL.vcxproj.user
文件 6881 2012-08-02 11:10 DepthmapToPointCloud_OpenGL\PointCloudDisplay.cpp
相关资源
- 一种机载LiDAR和车载LiDAR点云的自动配
- Kinect手势代替鼠标控制PC
- SfM稀疏三维点云重建--完整工程文件
- 全面的点云库PCL学习教程
- 彩色图片和深度图片生成点云文件
- ICP+NDT点云配准
- 1种新的散乱点云快速去噪算法
- 点云库PCL学习教程 完整版
- .las格式点云文件
- 使用OpenNI自带的类进行简单手势识别
- icp三维点云配准文件
- 基于Kinect的三维重建
- 地形点云.pcd
- openGL实现三维点云显示
- GA+ICP代码
- 建筑物的地面扫描点云数据
- 点云拼接和拟合算法
- 点云TXT转换PCD
- PCL点云库SACSegmentation用法demo
- 小兔子pcd点云数据pcl官方案例1)
- 八叉树点云精简
- fandisk点云数据,asc文件数据,三维模
- 斯坦福数据集六个txt格式点云文件.
- 点云试验数据
- Generalized-ICP 论文
- 点云测量数据处理
- OpenNI 官方版适用于Windows 32位系统
-
fast desc
riptors点云粗配准配准论文, - 点云数据读取 使用osg 附带点云数据
- osg显示点云
评论
共有 条评论