feat:3D multi dot
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
class GlobalHelper {
|
||||
public:
|
||||
@@ -17,7 +18,7 @@ public:
|
||||
}
|
||||
|
||||
static void transToMultiMatrix(const cv::Mat& raw_data, float min_threshold,
|
||||
float max_range, cv::Size display_res, cv::Mat& out_image) {
|
||||
float max_range, cv::Size display_res, cv::Mat& out_matrix) {
|
||||
CV_Assert(raw_data.type() == CV_32F);
|
||||
|
||||
cv::Mat raw = raw_data.clone();
|
||||
@@ -29,7 +30,8 @@ public:
|
||||
cv::GaussianBlur(raw, raw, cv::Size(3, 3), 0.8, 0.8, cv::BORDER_DEFAULT);
|
||||
}
|
||||
|
||||
cv::Mat norm_data = raw / max_range;
|
||||
const float safe_range = std::max(max_range, 1e-6f);
|
||||
cv::Mat norm_data = raw / safe_range;
|
||||
cv::min(norm_data, 1.0f, norm_data);
|
||||
cv::max(norm_data, 0.0f, norm_data);
|
||||
|
||||
@@ -40,10 +42,11 @@ public:
|
||||
|
||||
cv::GaussianBlur(smoothed, smoothed, cv::Size(31, 31), 0.0, 0.0, cv::BORDER_DEFAULT);
|
||||
|
||||
cv::transpose(smoothed, out_image);
|
||||
smoothed *= safe_range;
|
||||
out_matrix = smoothed;
|
||||
}
|
||||
private:
|
||||
GlobalHelper() {}
|
||||
};
|
||||
|
||||
#endif //TACTILEIPC3D_GLOBALHELPER_H
|
||||
#endif //TACTILEIPC3D_GLOBALHELPER_H
|
||||
|
||||
Reference in New Issue
Block a user