20inline void set_values(std::vector<int32_t>& values,
const std::vector<std::vector<int32_t>>& mat) {
21 int height = mat.size(), width = mat[0].size();
23 for (
int x = 0; x < height; x++) {
24 for (
int y = 0; y < width; y++) {
25 values[index++] = mat[x][y];
42 Image resulted_img(height, width);
43 std::vector<std::vector<int32_t>> mask = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
44 std::vector<int32_t> values(9, 0);
45 for (
int x = 0; x < height; x++) {
46 for (
int y = 0; y < width; y++) {
48 if (x - 1 >= 0 && y - 1 >= 0) {
57 if (x + 1 < height && y - 1 >= 0) {
60 if (x - 1 >= 0 && y + 1 < width) {
66 if (x + 1 < height && y + 1 < width) {
73 std::sort(values.begin(), values.end());