From 468677b949507470377735e658ca2415d70cdaf9 Mon Sep 17 00:00:00 2001 From: Patrycjusz Mania Date: Tue, 11 May 2021 22:28:38 +0200 Subject: [PATCH] zadanie-5 --- src/core/transformations/blur_linear.cpp | 2 +- src/core/transformations/edge_prewitt.cpp | 10 +++++----- src/core/transformations/edge_roberts.cpp | 8 ++++---- src/core/transformations/edge_sobel.cpp | 10 +++++----- src/core/transformations/edge_zero.cpp | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/core/transformations/blur_linear.cpp b/src/core/transformations/blur_linear.cpp index 6d52f25..688607b 100644 --- a/src/core/transformations/blur_linear.cpp +++ b/src/core/transformations/blur_linear.cpp @@ -27,7 +27,7 @@ PNM* BlurLinear::transform() for (int x=0;x(3,3, array_x); g_y = math::matrix(3,3, array_y); diff --git a/src/core/transformations/edge_roberts.cpp b/src/core/transformations/edge_roberts.cpp index a2d7817..5829af6 100644 --- a/src/core/transformations/edge_roberts.cpp +++ b/src/core/transformations/edge_roberts.cpp @@ -16,14 +16,14 @@ EdgeRoberts::EdgeRoberts(PNM* img, ImageViewer* iv) : void EdgeRoberts::prepareMatrices() { g_x = math::matrix(2,2); - g_x[0][0] = 1; + g_x[0][0] = -1; g_x[0][1] = 0; g_x[1][0] = 0; - g_x[1][1] = -1; + g_x[1][1] = 1; g_y = math::matrix(2,2); g_y[0][0] = 0; - g_y[0][1] = 1; - g_y[1][0] = -1; + g_y[0][1] = -1; + g_y[1][0] = 1; g_y[1][1] = 0; } diff --git a/src/core/transformations/edge_sobel.cpp b/src/core/transformations/edge_sobel.cpp index 1af5820..b457b3d 100644 --- a/src/core/transformations/edge_sobel.cpp +++ b/src/core/transformations/edge_sobel.cpp @@ -14,13 +14,13 @@ EdgeSobel::EdgeSobel(PNM* img) : void EdgeSobel::prepareMatrices() { - float array_x[9] = {-1,0,1, - -2,0,2, - -1,0,1}; + float array_x[9] = {1,0,-1, + 2,0,-2, + 1,0,-1}; - float array_y[9] = {-1,-2,-1, + float array_y[9] = {1,2,1, 0,0,0, - 1,2,1}; + -1,-2,-1}; g_x = math::matrix(3,3, array_x); g_y = math::matrix(3,3, array_y); diff --git a/src/core/transformations/edge_zero.cpp b/src/core/transformations/edge_zero.cpp index 30ecd40..a22e767 100644 --- a/src/core/transformations/edge_zero.cpp +++ b/src/core/transformations/edge_zero.cpp @@ -35,7 +35,7 @@ PNM* EdgeZeroCrossing::transform() float min = mask.min(); 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 newImage->setPixel(x,y, QColor(0, 0, 0).rgb()); }