1
0
lpo-image-processing/07/do_sprawdzenia/cpp/morph_erode.cpp
2021-04-06 11:08:47 +02:00

30 lines
569 B
C++

#include "morph_erode.h"
MorphErode::MorphErode(PNM* img) :
MorphologicalOperator(img)
{
}
MorphErode::MorphErode(PNM* img, ImageViewer* iv) :
MorphologicalOperator(img, iv)
{
}
const int MorphErode::morph(math::matrix<float> window, math::matrix<bool> se)
{
float max = 0.0;
for (int i = 0; i < int(window.colsize()); i++)
{
for(int j = 0; j < int(window.rowsize()); j++)
{
if(se[i][j] == true && window[i][j] > max)
{
max = window[i][j];
}
}
}
return max;
}