AlgoPlus v0.1.0
Loading...
Searching...
No Matches
average_filter.h
1#ifndef AVERAGE_FILTER_H
2#define AVERAGE_FILTER_H
3
4#ifdef __cplusplus
5#include <iostream>
6#include "../image.h"
7#endif
8
12namespace avg_filter {
13
21inline std::vector<std::vector<int32_t>>
22apply_avg_filter(const std::vector<std::vector<int32_t>>& image) {
23 Image img(image);
24 std::vector<std::vector<float>> kernel = {
25 {1.0 / 9, 1.0 / 9, 1.0 / 9}, {1.0 / 9, 1.0 / 9, 1.0 / 9}, {1.0 / 9, 1.0 / 9, 1.0 / 9}};
26 return img.apply_filter2d(kernel).get_2d_array();
27}
28} // namespace avg_filter
29
30#endif
Definition image.h:13
std::vector< std::vector< int32_t > > get_2d_array() const
get_2d_array function
Definition image.h:63
Image apply_filter2d(std::vector< std::vector< T > > &filter) const
apply_filter2d function
Definition image.h:207
average filter namespace
Definition average_filter.h:12
std::vector< std::vector< int32_t > > apply_avg_filter(const std::vector< std::vector< int32_t > > &image)
apply_avg_filter function: applies a 3x3 average filter to passed image: image
Definition average_filter.h:22