-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage_utils.h
More file actions
46 lines (32 loc) · 1.63 KB
/
image_utils.h
File metadata and controls
46 lines (32 loc) · 1.63 KB
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
#ifndef IMAGE_UTILS
#define IMAGE_UTILS
#include "opencv2/imgproc/imgproc.hpp"
#include "status_defs.h"
namespace image_utils {
// This is a namespace used for unit-testing functions that should not be
// visible as part of the public interface.
namespace internal {
status_defs::Status GetImageSlice(const cv::Mat& image_in, cv::Mat* slice,
int row_index, int col_index, int window_width, int window_height);
} // namespace internal
// Computes the output of a convolution kernel for a single pixel.
typedef std::function<double(int row_index, int col_index, int filter_width,
int filter_height)> CONVOLUTION_FUNC;
// Convolutes image_in with the given filter and stores the result in
// image_out.
status_defs::Status ConvolveImageWithFilter(const cv::Mat& image_in,
cv::Mat* image_out, CONVOLUTION_FUNC filter, int filter_width,
int filter_height);
bool MatsAreEqual(const cv::Mat& mat1, const cv::Mat& mat2);
// Computes a function over a window of pixel values. Outputs one value for
// each channel of the input matrix.
typedef std::function<std::vector<double>(const cv::Mat& window)> WINDOW_FUNC;
// Slides a window function over an image and puts the resulting output into
// an output matrix. This is effectively a more general form of convolution
// that allows you to do anything you want with the pixels in a given window.
status_defs::Status ApplyWindowFunctionToImage(const cv::Mat& image_in,
cv::Mat* image_out, WINDOW_FUNC func, int window_width, int window_height);
cv::Mat convert_to_uchar_image(const cv::Mat& m);
void normalize_depth_map(cv::Mat* img_depth_map, int max_depth);
} // namespace image_utils
#endif