AlgoPlus
v0.1.0
Loading...
Searching...
No Matches
src
machine_learning
image
filters
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
12
namespace
avg_filter
{
13
21
inline
std::vector<std::vector<int32_t>>
22
apply_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
Image
Definition
image.h:13
Image::get_2d_array
std::vector< std::vector< int32_t > > get_2d_array() const
get_2d_array function
Definition
image.h:63
Image::apply_filter2d
Image apply_filter2d(std::vector< std::vector< T > > &filter) const
apply_filter2d function
Definition
image.h:207
avg_filter
average filter namespace
Definition
average_filter.h:12
avg_filter::apply_avg_filter
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
Generated by
1.13.2