Beispiel #1
0
 def apply_laplacian(img):
     r, g, b = rgb.get_rgb_layers(img)
     r, r_sharpened = filter.apply_laplacian(r)
     g, g_sharpened = filter.apply_laplacian(g)
     b, b_sharpened = filter.apply_laplacian(b)
     return rgb.merge_rgb_layers(r, g, b), rgb.merge_rgb_layers(
         r_sharpened, g_sharpened, b_sharpened)
 def apply_piecewise_linear(self,
                            coordinates_x=[0, 255],
                            coordinates_y=[255, 0]):
     image = filter.apply_piecewise_linear(self.current_image,
                                           coordinates_x, coordinates_y)
     self.update_memory_images(image)
     return self.current_image
    def show_histogram(self):
        a = filter.histogram(self.current_image)
        f = plt.figure()
        _ = plt.hist(a, bins='auto')  # arguments are passed to np.histogram
        plt.title("Histogram")

        self.update_memory_images(self.current_image)

        return util.fig2img(f)
    def apply_fourier(self):
        ft = self.fourierManager.fft2(self.current_image)
        shift = self.fourierManager.fftshift(ft)
        self.fourier_image = shift
        self.current_complete_fourier = shift.copy()
        mag = abs(shift)
        mag = np.log(mag)
        mag = filter.normalize_image(mag)
        mag = mag.astype(np.uint8).copy()

        self.update_fourier_memory_images(mag)

        return self.fourier_image
 def save(self, name):
     filter.save_image(name, self.current_image)
 def apply_gaussian(self, filter_size, sigma):
     image = filter.apply_gaussian(self.current_image, filter_size, sigma)
     self.update_memory_images(image)
     return self.current_image
 def saveImage(self, name, image):
     filter.save_image(name, image)
def test_harmonic_mean_for_int_array():
    input = np.array([1, 2, 4])
    obtained = filter.get_harmonic_mean(input)
    assert obtained == 1.714
Beispiel #9
0
 def apply_gradient(img, filter_matrix):
     r, g, b = rgb.get_rgb_layers(img)
     r = filter.apply_gradient(r, filter_matrix)
     g = filter.apply_gradient(g, filter_matrix)
     b = filter.apply_gradient(b, filter_matrix)
     return rgb.merge_rgb_layers(r, g, b)
 def gammaTransform(self, gamma):
     image = filter.apply_gamma_correction(self.current_image, gamma)
     self.update_memory_images(image)
     return self.current_image
Beispiel #11
0
 def apply_negative(img):
     r, g, b = rgb.get_rgb_layers(img)
     r = filter.apply_negative(r)
     g = filter.apply_negative(g)
     b = filter.apply_negative(b)
     return rgb.merge_rgb_layers(r, g, b)
 def apply_geometric_mean(self, filter_size=3):
     image = filter.apply_geometric_mean(self.current_image, filter_size)
     self.update_memory_images(image)
     return self.current_image
 def apply_contra_harmonic_mean(self, filter_size, q):
     image = filter.apply_contra_harmonic_mean(self.current_image,
                                               filter_size, q)
     self.update_memory_images(image)
     return self.current_image
 def apply_sobel(self):
     image = filter.apply_sobel(self.current_image)
     self.update_memory_images(image)
     return self.current_image
 def apply_gradient(self, filter_matrix):
     image = filter.apply_gradient(self.current_image, filter_matrix)
     self.update_memory_images(image)
     return self.current_image
 def apply_convolution(self, filter_matrix):
     image = filter.apply_convolution(self.current_image, filter_matrix)
     self.update_memory_images(image)
     return self.current_image
Beispiel #17
0
 def apply_arithmetic_mean(img, filter_matrix):
     r, g, b = rgb.get_rgb_layers(img)
     r = filter.apply_arithmetic_mean(r, filter_matrix)
     g = filter.apply_arithmetic_mean(g, filter_matrix)
     b = filter.apply_arithmetic_mean(b, filter_matrix)
     return rgb.merge_rgb_layers(r, g, b)
Beispiel #18
0
 def apply_sobel(img):
     r, g, b = rgb.get_rgb_layers(img)
     r = filter.apply_sobel(r)
     g = filter.apply_sobel(g)
     b = filter.apply_sobel(b)
     return rgb.merge_rgb_layers(r, g, b)
 def negativeTransform(self):
     image = (filter.apply_negative(self.current_image)).astype(np.uint8)
     self.update_memory_images(image)
     return self.current_image
 def apply_highboost(self, filter_size, c):
     image, mask = filter.apply_highboost(self.current_image, c,
                                          filter_size)
     self.update_memory_images(image)
     return self.current_image
 def logarithmicTransform(self, c):
     image = filter.apply_logarithmic(self.current_image, c)
     self.update_memory_images(image)
     return self.current_image
def test_harmonic_mean_for_matrix():
    input = np.array([[1, 2, 4], [7, 9, 6], [15, 10, 1]])
    obtained = filter.get_harmonic_mean(input)
    assert obtained == 0.899
 def apply_equalized_histogram(self):
     image = filter.apply_histogram_equalization(self.current_image)
     self.update_memory_images(image)
     return self.current_image
Beispiel #24
0
 def apply_piecewise_linear(img, coordinates_x, coordinates_y):
     r, g, b = rgb.get_rgb_layers(img)
     r = filter.apply_piecewise_linear(r, coordinates_x, coordinates_y)
     g = filter.apply_piecewise_linear(g, coordinates_x, coordinates_y)
     b = filter.apply_piecewise_linear(b, coordinates_x, coordinates_y)
     return rgb.merge_rgb_layers(r, g, b)
 def apply_median(self, filter_size):
     image = filter.apply_median(self.current_image, filter_size)
     self.update_memory_images(image)
     return self.current_image
 def apply_laplacian(self):
     image, mask = filter.apply_laplacian(self.current_image)
     self.update_memory_images(image)
     return self.current_image
def test_harmonic_mean_for_int_list():
    input = [1, 2, 4]
    obtained = filter.get_harmonic_mean(input)
    assert obtained == 1.714
Beispiel #28
0
 def apply_convolution(img, filter_matrix):
     r, g, b = rgb.get_rgb_layers(img)
     r = filter.apply_convolution(r, filter_matrix)
     g = filter.apply_convolution(g, filter_matrix)
     b = filter.apply_convolution(b, filter_matrix)
     return rgb.merge_rgb_layers(r, g, b)
def test_harmonic_mean_for_float_array():
    input = np.array([1.0, 2.0, 4.0])
    obtained = filter.get_harmonic_mean(input)
    assert obtained == 1.714
Beispiel #30
0
 def apply_median(img, filter_size):
     r, g, b = rgb.get_rgb_layers(img)
     r = filter.apply_median(r, filter_size)
     g = filter.apply_median(g, filter_size)
     b = filter.apply_median(b, filter_size)
     return rgb.merge_rgb_layers(r, g, b)