0

関数 DepthCleaner() を method = DEPTH_CLEANER_NIL で使用して深度画像をきれいにするのに問題があります。この関数は OpenCV 3.0.0 でリリースされました。したがって、この関数に関する有用なドキュメントを見つけるのは時期尚早です。この関数を既に使用したことがある場合は、きれいな深度画像を取得するために使用する関数とコードのセットを教えてください。たとえば、「Img1.png」という名前の Kinect1 からの深度画像があるとします。次のように画像を宣言し、DepthCleaner を使用しています。

    char fileName[64];
    Mat depth_image = Mat(480, 640, CV_16UC1);
    Mat output = Mat(480, 640, CV_16U);

    snprintf(fileName, sizeof(fileName), "Depth_Image/Img1.png");
    depth_image = imread(fileName, -1);
    namedWindow("Input image",WINDOW_AUTOSIZE);
    imshow ("Input image",depth_image);

    DepthCleaner* depthc = new DepthCleaner(CV_16U, 3, DepthCleaner::DEPTH_CLEANER_NIL);

    depthc->operator ()(depth_image,output);
    namedWindow("depthCleaner",WINDOW_AUTOSIZE);
    imshow ("depthCleaner",output);

私はC++を使用しています。しかし、私は正しい結果を得ていません。コードで何か間違ったことをしていると思います。私はまた、このコードのセットを使用してみました:

char fileName[64];
Mat depth_image = Mat(480, 640, CV_16UC1);
Mat output = Mat(480, 640, CV_16U);

float fx = 525.0f, // default
          fy = 525.0f,
          cx = 319.5f,
          cy = 239.5f;
    Mat cameraMatrix = Mat::eye(3,3,CV_32FC1);
    {
        cameraMatrix.at<float>(0,0) = fx;
        cameraMatrix.at<float>(1,1) = fy;
        cameraMatrix.at<float>(0,2) = cx;
        cameraMatrix.at<float>(1,2) = cy;
    }

snprintf(fileName, sizeof(fileName), "Depth_Image/Img1.png");
depth_image = imread(fileName, -1);
namedWindow("Input image",WINDOW_AUTOSIZE);
imshow ("Input image",depth_image);

Mat point3DMat;
depthTo3d(depth_image, cameraMatrix, point3DMat);

DepthCleaner* depthc = new DepthCleaner(CV_16U, 3, DepthCleaner::DEPTH_CLEANER_NIL);

depthc->operator ()(point3DMat,output);
namedWindow("depthCleaner",WINDOW_AUTOSIZE);
imshow ("depthCleaner",output);

しかし、それも私を助けませんでした。上記のコードのこの行でコンパイラ エラーが発生します。

depthc->operator ()(point3DMat,output);). 

正しい方向に向けていただければ大変助かります。

4

1 に答える 1