34 lines
598 B
C++
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;
|
|
}
|
|
|