문제

실제로 ASUS Xtion에서 RGB 이미지를 얻을 수 있지만 깊이 이미지를 얻을 수 없습니다. 대신 검은 이미지가 보이고 오류가 나타나지 않습니다.

OpenNi가 제공하는 샘플 단순 뷰는 센서가 아니라고 생각합니다. 라이브러리가 아니라 OpenCV가 올바르게 작동하는 것 같습니다.

아이디어가 있습니까?

내 코드는 다음과 같습니다.

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

#include <iostream>

using namespace cv;
using namespace std;

int main( int argc, char* argv[] )
{

    cout << "Device opening ..." << endl;
    VideoCapture captureStream;
    captureStream.open(CV_CAP_OPENNI_ASUS);


    if( !captureStream.isOpened() ){
        cout << "Can not open capture object." << endl;
        return -1;
    }

    for(;;){
        Mat depth;

        if( !captureStream.grab() ){
            cout << "ASUS Xtion can not grab images." << endl;
            return -1;
        }else
            if( captureStream.retrieve( depth, CV_CAP_OPENNI_DEPTH_MAP) )
                imshow("depth",depth);

        if( waitKey( 30 ) == 27 )   break;

    }

    return 0;
}

고맙습니다!

도움이 되었습니까?

해결책

그만큼 OpenCV 샘플 코드 실제로이 코드를 사용하여 깊이 맵을 검색하고 표시합니다.

Mat depth;
capture.retrieve( depth, CV_CAP_OPENNI_DEPTH_MAP )
const float scaleFactor = 0.05f;
Mat show; 
depth.convertTo( show, CV_8UC1, scaleFactor );
imshow( "depth map", show );
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top