Hi,
I would like to do Spatial and temporal on a depth image. spatial average can be achieved by convolution (cv::filter2D), for temporal average you would need to accumulate() N images, and divide by N but I don't know how to use OpenCV to do that.
What I tried for spatial filter is
cv::Mat dst;
int kernel_size = 2;
cv::Mat kernel = cv::Mat::ones(kernel_size, kernel_size, CV_32F) / (float)(kernel_size * kernel_size);
// Apply filter
filter2D(depth_image_ocv, dst, -1, kernel, cv::Point(-1, -1), 0, cv::BORDER_DEFAULT);
but the result is horrible as shown in the image.
cv::imshow("Filtered Depth", dst);
cv::imshow("Depth", depth_image_ocv);