1
0
lpo-image-processing/08/do_sprawdzenia/cpp/edge_laplacian.cpp
2021-04-06 13:34:01 +02:00

34 lines
598 B
C++

#include "edge_laplacian.h"
EdgeLaplacian::EdgeLaplacian(PNM* img) :
Convolution(img)
{
}
EdgeLaplacian::EdgeLaplacian(PNM* img, ImageViewer* iv) :
Convolution(img, iv)
{
}
math::matrix<float> EdgeLaplacian::getMask(int, Mode)
{
int size = getParameter("size").toInt();
math::matrix<float> mask(size, size);
int center = size / 2;
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
mask(i, j) = -1;
}
}
// Calculate center element of mask
mask(center, center) = pow(size, 2) - 1;
return mask;
}