资源简介

非常详细的介绍Kinect相机的标定过程,是学习各种相机标定的参考材料。里面介绍了标定的原理标定的棋盘等。

资源截图

代码片段和文件信息

//////////////////////////////////////////////////////////////////
// Kinect capture
// by Daniel Herrera C.
//////////////////////////////////////////////////////////////////
#include “freenect_module.h“
#include 

namespace kinect_capture {

//////////////////////////////////////////////////////////////////
// Cfreenect_module members
//////////////////////////////////////////////////////////////////
Cfreenect_module::Cfreenect_module():
    die(false)
    mutex(PTHREAD_MUTEX_INITIALIZER)
    depth_frame(new cv::Mat1s())
    video_frame(new cv::Mat())
    got_depth(0) 
    got_video(0)
    f_ctx(NULL)
    f_dev(NULL)
    depth_back(new cv::Mat1s())
    video_back(new cv::Mat())
{
    pthread_cond_init(&data_ready_cond NULL);

    set_mode(
freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM FREENECT_VIDEO_YUV_RGB)
//freenect_find_video_mode(FREENECT_RESOLUTION_HIGH FREENECT_VIDEO_BAYER)
        freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM FREENECT_DEPTH_11BIT));
}

Cfreenect_module::~Cfreenect_module()
{
    pthread_cond_destroy(&data_ready_cond);
    delete video_frame;
    delete depth_frame;
    delete depth_back;
    delete video_back;
}

int Cfreenect_module::video_format2mat_type(freenect_video_format format) {
    switch(format){
    case FREENECT_VIDEO_RGB:
    case FREENECT_VIDEO_YUV_RGB:
        return CV_8UC3;
    case FREENECT_VIDEO_BAYER:
    case FREENECT_VIDEO_IR_8BIT:
        return CV_8UC1;
    }
}

void Cfreenect_module::set_mode(freenect_frame_mode video freenect_frame_mode depth) {
    video_mode = video;
    depth_mode = depth;
        
    depth_frame->create(depth.height depth.width);
    video_frame->create(video.height video.width Cfreenect_module::video_format2mat_type(video.video_format));
    depth_back->create(depth_mode.height depth_mode.width);
    video_back->create(video_mode.height video_mode.width Cfreenect_module::video_format2mat_type(video_mode.video_format));
}

void Cfreenect_module::static_depth_callback(freenect_device *dev void *depth uint32_t timestamp) {
    Cfreenect_module *module = (Cfreenect_module*)freenect_get_user(dev);
    module->depth_callback(devdepthtimestamp);
}
void Cfreenect_module::static_video_callback(freenect_device *dev void *video uint32_t timestamp) {
    Cfreenect_module *module = (Cfreenect_module*)freenect_get_user(dev);
    module->video_callback(devvideotimestamp);
}

void Cfreenect_module::depth_callback(freenect_device *dev void *depth uint32_t timestamp) {
    assert(depth == depth_back->data);
    pthread_mutex_lock(&mutex);

    std::swap(depth_back depth_frame); //Swap buffers

    freenect_set_depth_buffer(dev depth_back->data);
    got_depth++;
    
    pthread_mutex_unlock(&mutex);
    pthread_cond_signal(&data_ready_cond);
}

void Cfreenect_module::video_callback(freenect_device *dev void *video uint32_t timestamp) {
    ass

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-06-15 18:35  v2.1\
     目录           0  2012-06-15 18:35  v2.1\capture\
     文件        2789  2012-06-08 18:27  v2.1\capture\CMakeLists.txt
     文件        5196  2012-06-12 20:19  v2.1\capture\freenect_module.cpp
     文件        2060  2012-06-12 20:21  v2.1\capture\freenect_module.h
     文件        3944  2012-06-15 18:13  v2.1\capture\kinect_calibration.cpp
     文件        3924  2012-06-13 19:23  v2.1\capture\kinect_calibration.h
     文件         140  2012-06-11 18:34  v2.1\capture\kinect_capture.cpp
     文件       14139  2012-06-13 19:58  v2.1\capture\kinect_capture_app.cpp
     文件        3575  2012-06-11 19:59  v2.1\capture\kinect_capture_app.h
     目录           0  2012-06-15 18:29  v2.1\data\
     文件      141643  2012-01-25 16:45  v2.1\data\0000-c1.jpg
     文件      222016  2012-01-25 16:47  v2.1\data\0000-c2.jpg
     文件      614416  2011-07-11 21:15  v2.1\data\0000-d.pgm
     文件      143877  2012-01-25 16:45  v2.1\data\0001-c1.jpg
     文件      226893  2012-01-25 16:47  v2.1\data\0001-c2.jpg
     文件      614416  2011-07-11 21:17  v2.1\data\0001-d.pgm
     文件      145834  2012-01-25 16:45  v2.1\data\0002-c1.jpg
     文件      234339  2012-01-25 16:47  v2.1\data\0002-c2.jpg
     文件      614416  2011-07-11 21:18  v2.1\data\0002-d.pgm
     文件      150377  2012-01-25 16:45  v2.1\data\0003-c1.jpg
     文件      237642  2012-01-25 16:47  v2.1\data\0003-c2.jpg
     文件      614416  2011-07-11 21:18  v2.1\data\0003-d.pgm
     文件      186641  2012-01-25 16:45  v2.1\data\0004-c1.jpg
     文件      244325  2012-01-25 16:47  v2.1\data\0004-c2.jpg
     文件      614416  2011-07-11 21:19  v2.1\data\0004-d.pgm
     文件      204717  2012-01-25 16:45  v2.1\data\0005-c1.jpg
     文件      252354  2012-01-25 16:47  v2.1\data\0005-c2.jpg
     文件      614416  2011-07-11 21:21  v2.1\data\0005-d.pgm
     文件      215425  2012-01-25 16:45  v2.1\data\0006-c1.jpg
     文件      259406  2012-01-25 16:47  v2.1\data\0006-c2.jpg
............此处省略278个文件信息

评论

共有 条评论