diff --git a/components/rgbd-sources/include/ftl/offilter.hpp b/components/rgbd-sources/include/ftl/offilter.hpp index 194ee20fb39bf759afc1ba2804d16c074c4fd32d..c5e7a9cf7b02d11906043f8652ce615fe1ab5f52 100644 --- a/components/rgbd-sources/include/ftl/offilter.hpp +++ b/components/rgbd-sources/include/ftl/offilter.hpp @@ -13,12 +13,11 @@ namespace rgbd { class OFDisparityFilter { public: - OFDisparityFilter() : n_max_(0), threshold_(0.0), size_(0, 0) {} // TODO: invalid state + OFDisparityFilter() : n_max_(0), threshold_(0.0) {} OFDisparityFilter(cv::Size size, int n_frames, float threshold); void filter(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream); private: - int n_; int n_max_; float threshold_; diff --git a/components/rgbd-sources/src/algorithms/offilter.cu b/components/rgbd-sources/src/algorithms/offilter.cu index 546f94c1102c4bd6adb6a7d9e0ab96fb46787e26..6feee5ae1daf9fc8b4b165370dbb8646b1d7b8a1 100644 --- a/components/rgbd-sources/src/algorithms/offilter.cu +++ b/components/rgbd-sources/src/algorithms/offilter.cu @@ -21,19 +21,16 @@ __global__ void temporal_median_filter_kernel( cv::cuda::PtrStepSz<int16_t> optflow, cv::cuda::PtrStepSz<float> history, int n_max, - int16_t threshold // fixed point 10.5 - uint granularity // 4 for Turing + int16_t threshold, // fixed point 10.5 + float granularity // 4 for Turing ) { float sorted[max_history]; // TODO: dynamic shared memory for (STRIDE_Y(y, disp.rows)) { for (STRIDE_X(x, disp.cols)) { - int flowx = optflow(y, 2 * x); - int flowy = optflow(y, 2 * x + 1); - int flowx = optflow(round(y / granularity), 2 * round(x / granularity)); - int flowy = optflow(round(y/ granularity), 2 * round(x / granularity) + 1); + int flowy = optflow(round(y / granularity), 2 * round(x / granularity) + 1); if ((abs(flowx) + abs(flowy)) > threshold) { @@ -83,8 +80,8 @@ void optflow_filter(cv::cuda::GpuMat &disp, const cv::cuda::GpuMat &optflow, // TODO: dynamic shared memory temporal_median_filter_kernel<<<grid, threads, 0, cv::cuda::StreamAccessor::getStream(stream)>>> ( disp, optflow, history, n, - round(threshold * (1 << 5)) // TODO: documentation; 10.5 format - 4, // TODO: (4 pixels granularity for Turing) + round(threshold * (1 << 5)), // TODO: documentation; 10.5 format + 4 // TODO: (4 pixels granularity for Turing) ); cudaSafeCall(cudaGetLastError()); diff --git a/components/rgbd-sources/src/offilter.cpp b/components/rgbd-sources/src/offilter.cpp index 2fb6d162317d0d5563a8307061556e8e685562dc..bdf6f40a5bc63757b7b8239b1e8692fb6ea83271 100644 --- a/components/rgbd-sources/src/offilter.cpp +++ b/components/rgbd-sources/src/offilter.cpp @@ -15,7 +15,7 @@ using std::vector; template<typename T> static bool inline isValidDisparity(T d) { return (0.0 < d) && (d < 256.0); } // TODO OFDisparityFilter::OFDisparityFilter(Size size, int n_frames, float threshold) : - n_(0), n_max_(n_frames + 1), threshold_(threshold) + n_max_(n_frames + 1), threshold_(threshold) { CHECK((n_max_ > 1) && (n_max_ >= 32)) << "History length must be between 0 and 31!"; disp_old_ = cv::cuda::GpuMat(cv::Size(size.width * n_max_, size.height), CV_32FC1);