zadanie-5
This commit is contained in:
parent
729014c9c8
commit
468677b949
@ -27,7 +27,7 @@ PNM* BlurLinear::transform()
|
|||||||
|
|
||||||
for (int x=0;x<maskSize;++x) {
|
for (int x=0;x<maskSize;++x) {
|
||||||
for (int y=0;y<maskSize;++y) {
|
for (int y=0;y<maskSize;++y) {
|
||||||
double val = tmpMask.at((x * maskSize) + y).toDouble();
|
double val = tmpMask.at((y * maskSize) + x).toDouble();
|
||||||
if (normalize && maskSum != 0.0) {
|
if (normalize && maskSum != 0.0) {
|
||||||
val /= maskSum;
|
val /= maskSum;
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,13 @@ EdgePrewitt::EdgePrewitt(PNM*img, ImageViewer* iv) :
|
|||||||
|
|
||||||
void EdgePrewitt::prepareMatrices()
|
void EdgePrewitt::prepareMatrices()
|
||||||
{
|
{
|
||||||
float array_x[9] = {-1,0,1,
|
float array_x[9] = {1,0,-1,
|
||||||
-1,0,1,
|
1,0,-1,
|
||||||
-1,0,1};
|
1,0,-1};
|
||||||
|
|
||||||
float array_y[9] = {-1,-1,-1,
|
float array_y[9] = {1,1,1,
|
||||||
0,0,0,
|
0,0,0,
|
||||||
1,1,1};
|
-1,-1,-1};
|
||||||
|
|
||||||
g_x = math::matrix<float>(3,3, array_x);
|
g_x = math::matrix<float>(3,3, array_x);
|
||||||
g_y = math::matrix<float>(3,3, array_y);
|
g_y = math::matrix<float>(3,3, array_y);
|
||||||
|
@ -16,14 +16,14 @@ EdgeRoberts::EdgeRoberts(PNM* img, ImageViewer* iv) :
|
|||||||
void EdgeRoberts::prepareMatrices()
|
void EdgeRoberts::prepareMatrices()
|
||||||
{
|
{
|
||||||
g_x = math::matrix<float>(2,2);
|
g_x = math::matrix<float>(2,2);
|
||||||
g_x[0][0] = 1;
|
g_x[0][0] = -1;
|
||||||
g_x[0][1] = 0;
|
g_x[0][1] = 0;
|
||||||
g_x[1][0] = 0;
|
g_x[1][0] = 0;
|
||||||
g_x[1][1] = -1;
|
g_x[1][1] = 1;
|
||||||
|
|
||||||
g_y = math::matrix<float>(2,2);
|
g_y = math::matrix<float>(2,2);
|
||||||
g_y[0][0] = 0;
|
g_y[0][0] = 0;
|
||||||
g_y[0][1] = 1;
|
g_y[0][1] = -1;
|
||||||
g_y[1][0] = -1;
|
g_y[1][0] = 1;
|
||||||
g_y[1][1] = 0;
|
g_y[1][1] = 0;
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,13 @@ EdgeSobel::EdgeSobel(PNM* img) :
|
|||||||
|
|
||||||
void EdgeSobel::prepareMatrices()
|
void EdgeSobel::prepareMatrices()
|
||||||
{
|
{
|
||||||
float array_x[9] = {-1,0,1,
|
float array_x[9] = {1,0,-1,
|
||||||
-2,0,2,
|
2,0,-2,
|
||||||
-1,0,1};
|
1,0,-1};
|
||||||
|
|
||||||
float array_y[9] = {-1,-2,-1,
|
float array_y[9] = {1,2,1,
|
||||||
0,0,0,
|
0,0,0,
|
||||||
1,2,1};
|
-1,-2,-1};
|
||||||
|
|
||||||
g_x = math::matrix<float>(3,3, array_x);
|
g_x = math::matrix<float>(3,3, array_x);
|
||||||
g_y = math::matrix<float>(3,3, array_y);
|
g_y = math::matrix<float>(3,3, array_y);
|
||||||
|
@ -35,7 +35,7 @@ PNM* EdgeZeroCrossing::transform()
|
|||||||
float min = mask.min();
|
float min = mask.min();
|
||||||
|
|
||||||
if (min < v0 - t && max > v0 + t)
|
if (min < v0 - t && max > v0 + t)
|
||||||
newImage->setPixel(x,y, QColor(lapsjan, lapsjan, lapsjan).rgb());
|
newImage->setPixel(x,y, QColor(255, 255, 255).rgb());
|
||||||
else
|
else
|
||||||
newImage->setPixel(x,y, QColor(0, 0, 0).rgb());
|
newImage->setPixel(x,y, QColor(0, 0, 0).rgb());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user