2023-01-24 18:52:45 +01:00
|
|
|
|
|
|
|
#ifndef MLPP_CONVOLUTIONS_H
|
|
|
|
#define MLPP_CONVOLUTIONS_H
|
2023-01-23 21:13:26 +01:00
|
|
|
|
2023-01-24 19:14:38 +01:00
|
|
|
#include <string>
|
2023-02-12 18:20:53 +01:00
|
|
|
#include <vector>
|
2023-01-23 21:13:26 +01:00
|
|
|
|
2023-01-27 13:01:16 +01:00
|
|
|
#include "core/math/math_defs.h"
|
|
|
|
|
2023-02-12 18:20:53 +01:00
|
|
|
#include "core/object/reference.h"
|
|
|
|
|
|
|
|
class MLPPConvolutions : public Reference {
|
|
|
|
GDCLASS(MLPPConvolutions, Reference);
|
|
|
|
|
2023-01-24 19:00:54 +01:00
|
|
|
public:
|
2023-02-13 00:45:07 +01:00
|
|
|
std::vector<std::vector<real_t>> convolve_2d(std::vector<std::vector<real_t>> input, std::vector<std::vector<real_t>> filter, int S, int P = 0);
|
|
|
|
std::vector<std::vector<std::vector<real_t>>> convolve_3d(std::vector<std::vector<std::vector<real_t>>> input, std::vector<std::vector<std::vector<real_t>>> filter, int S, int P = 0);
|
|
|
|
|
|
|
|
std::vector<std::vector<real_t>> pool_2d(std::vector<std::vector<real_t>> input, int F, int S, std::string type);
|
|
|
|
std::vector<std::vector<std::vector<real_t>>> pool_3d(std::vector<std::vector<std::vector<real_t>>> input, int F, int S, std::string type);
|
|
|
|
|
|
|
|
real_t global_pool_2d(std::vector<std::vector<real_t>> input, std::string type);
|
|
|
|
std::vector<real_t> global_pool_3d(std::vector<std::vector<std::vector<real_t>>> input, std::string type);
|
2023-01-27 13:01:16 +01:00
|
|
|
|
2023-02-13 00:45:07 +01:00
|
|
|
real_t gaussian_2d(real_t x, real_t y, real_t std);
|
|
|
|
std::vector<std::vector<real_t>> gaussian_filter_2d(int size, real_t std);
|
2023-01-27 13:01:16 +01:00
|
|
|
|
|
|
|
std::vector<std::vector<real_t>> dx(std::vector<std::vector<real_t>> input);
|
|
|
|
std::vector<std::vector<real_t>> dy(std::vector<std::vector<real_t>> input);
|
|
|
|
|
2023-02-13 00:45:07 +01:00
|
|
|
std::vector<std::vector<real_t>> grad_magnitude(std::vector<std::vector<real_t>> input);
|
|
|
|
std::vector<std::vector<real_t>> grad_orientation(std::vector<std::vector<real_t>> input);
|
2023-01-27 13:01:16 +01:00
|
|
|
|
2023-02-13 00:45:07 +01:00
|
|
|
std::vector<std::vector<std::vector<real_t>>> compute_m(std::vector<std::vector<real_t>> input);
|
|
|
|
std::vector<std::vector<std::string>> harris_corner_detection(std::vector<std::vector<real_t>> input);
|
2023-01-27 13:01:16 +01:00
|
|
|
|
2023-02-13 00:45:07 +01:00
|
|
|
std::vector<std::vector<real_t>> get_prewitt_horizontal();
|
|
|
|
std::vector<std::vector<real_t>> get_prewitt_vertical();
|
|
|
|
std::vector<std::vector<real_t>> get_sobel_horizontal();
|
|
|
|
std::vector<std::vector<real_t>> get_sobel_vertical();
|
|
|
|
std::vector<std::vector<real_t>> get_scharr_horizontal();
|
|
|
|
std::vector<std::vector<real_t>> get_scharr_vertical();
|
|
|
|
std::vector<std::vector<real_t>> get_roberts_horizontal();
|
|
|
|
std::vector<std::vector<real_t>> get_roberts_vertical();
|
|
|
|
|
|
|
|
MLPPConvolutions();
|
2023-01-24 19:00:54 +01:00
|
|
|
|
2023-02-12 18:20:53 +01:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2023-02-13 00:45:07 +01:00
|
|
|
std::vector<std::vector<real_t>> _prewitt_horizontal;
|
|
|
|
std::vector<std::vector<real_t>> _prewitt_vertical;
|
|
|
|
std::vector<std::vector<real_t>> _sobel_horizontal;
|
|
|
|
std::vector<std::vector<real_t>> _sobel_vertical;
|
|
|
|
std::vector<std::vector<real_t>> _scharr_horizontal;
|
|
|
|
std::vector<std::vector<real_t>> _scharr_vertical;
|
|
|
|
std::vector<std::vector<real_t>> _roberts_horizontal;
|
|
|
|
std::vector<std::vector<real_t>> _roberts_vertical;
|
2023-01-24 19:00:54 +01:00
|
|
|
};
|
2023-01-23 21:13:26 +01:00
|
|
|
|
|
|
|
#endif // Convolutions_hpp
|