-
Notifications
You must be signed in to change notification settings - Fork 11
/
FilterPointCould.h
66 lines (53 loc) · 2.43 KB
/
FilterPointCould.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <cuda_runtime.h>
#include <helper_cuda.h>
#include <device_launch_parameters.h>
#include <device_functions.h>
#include <thrust/sort.h>
#include <thrust/device_vector.h>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "wUtils.h"
class TBFilterPointCould
{
public:
TBFilterPointCould();
~TBFilterPointCould();
void SetTopVertex(std::vector<cv::Vec4f> *_vertex, cv::Mat_<float> *_camera_pose, cv::Mat_<float> *_camera_fxfycxcy, int _width, int _height);
void SetBottomVertex(std::vector<cv::Vec4f> *_vertex, cv::Mat_<float> *_camera_pose, cv::Mat_<float> *_camera_fxfycxcy, int _width, int _height);
void Fileter(int _edge_range, int _dis_thresh);
std::vector<float4>& get_top_filter_vertex()
{
h_top_filter_vertex_.resize(d_top_filter_vertex_.size());
checkCudaErrors(cudaMemcpy(h_top_filter_vertex_.data(), RAW_PTR(d_top_filter_vertex_), h_top_filter_vertex_.size() * sizeof(float4), cudaMemcpyDeviceToHost));
return h_top_filter_vertex_;
}
std::vector<float4>& get_bottom_filter_vertex()
{
h_bottom_filter_vertex_.resize(d_bottom_filter_vertex_.size());
checkCudaErrors(cudaMemcpy(h_bottom_filter_vertex_.data(), RAW_PTR(d_bottom_filter_vertex_), h_bottom_filter_vertex_.size() * sizeof(float4), cudaMemcpyDeviceToHost));
return h_bottom_filter_vertex_;
}
private:
int trows_, tcols_;
thrust::device_vector<float4> d_top_vertex_;
thrust::device_vector<float4> d_top_camera_pose_inv_t_;
float4 h_top_camera_fxfycxcy_;
thrust::device_vector<float> d_top_depth_map_;
thrust::device_vector<int> d_top_index_map_;
thrust::device_vector<float4> d_top_filter_vertex_;
thrust::device_vector<int> d_top_filter_vertex_num_;
thrust::device_vector<float> d_top_nearest_dis_;
thrust::device_vector<int> d_top_nearest_idx_;
std::vector<float4> h_top_filter_vertex_;
int brows_, bcols_;
thrust::device_vector<float4> d_bottom_vertex_;
thrust::device_vector<float4> d_bottom_camera_pose_inv_t_;
float4 h_bottom_camera_fxfycxcy_;
thrust::device_vector<float> d_bottom_depth_map_;
thrust::device_vector<int> d_bottom_index_map_;
thrust::device_vector<float4> d_bottom_filter_vertex_;
thrust::device_vector<int> d_bottom_filter_vertex_num_;
std::vector<float4> h_bottom_filter_vertex_;
};