mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-04 16:57:32 +08:00
isort --profile black . (#2181)
* updating DIRECTORY.md * isort --profile black . * Black after * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
"""
|
||||
Implemented an algorithm using opencv to convert a colored image into its negative
|
||||
"""
|
||||
|
||||
from cv2 import imread, imshow, waitKey, destroyAllWindows
|
||||
from cv2 import destroyAllWindows, imread, imshow, waitKey
|
||||
|
||||
|
||||
def convert_to_negative(img):
|
||||
|
@ -1,8 +1,8 @@
|
||||
"""
|
||||
Implementation Burke's algorithm (dithering)
|
||||
"""
|
||||
from cv2 import destroyAllWindows, imread, imshow, waitKey
|
||||
import numpy as np
|
||||
from cv2 import destroyAllWindows, imread, imshow, waitKey
|
||||
|
||||
|
||||
class Burkes:
|
||||
|
@ -1,5 +1,6 @@
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
from digital_image_processing.filters.convolve import img_convolve
|
||||
from digital_image_processing.filters.sobel_filter import sobel_filter
|
||||
|
||||
|
@ -9,11 +9,11 @@ Inputs:
|
||||
Output:
|
||||
img:A 2d zero padded image with values in between 0 and 1
|
||||
"""
|
||||
import math
|
||||
import sys
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
import math
|
||||
import sys
|
||||
|
||||
|
||||
def vec_gaussian(img: np.ndarray, variance: float) -> np.ndarray:
|
||||
|
@ -1,8 +1,8 @@
|
||||
# @Author : lightXu
|
||||
# @File : convolve.py
|
||||
# @Time : 2019/7/8 0008 下午 16:13
|
||||
from cv2 import imread, cvtColor, COLOR_BGR2GRAY, imshow, waitKey
|
||||
from numpy import array, zeros, ravel, pad, dot, uint8
|
||||
from cv2 import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
|
||||
from numpy import array, dot, pad, ravel, uint8, zeros
|
||||
|
||||
|
||||
def im2col(image, block_size):
|
||||
|
@ -1,10 +1,11 @@
|
||||
"""
|
||||
Implementation of gaussian filter algorithm
|
||||
"""
|
||||
from cv2 import imread, cvtColor, COLOR_BGR2GRAY, imshow, waitKey
|
||||
from numpy import pi, mgrid, exp, square, zeros, ravel, dot, uint8
|
||||
from itertools import product
|
||||
|
||||
from cv2 import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
|
||||
from numpy import dot, exp, mgrid, pi, ravel, square, uint8, zeros
|
||||
|
||||
|
||||
def gen_gaussian_kernel(k_size, sigma):
|
||||
center = k_size // 2
|
||||
|
@ -1,9 +1,8 @@
|
||||
"""
|
||||
Implementation of median filter algorithm
|
||||
"""
|
||||
|
||||
from cv2 import imread, cvtColor, COLOR_BGR2GRAY, imshow, waitKey
|
||||
from numpy import zeros_like, ravel, sort, multiply, divide, int8
|
||||
from cv2 import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
|
||||
from numpy import divide, int8, multiply, ravel, sort, zeros_like
|
||||
|
||||
|
||||
def median_filter(gray_img, mask=3):
|
||||
|
@ -2,7 +2,8 @@
|
||||
# @File : sobel_filter.py
|
||||
# @Time : 2019/7/8 0008 下午 16:26
|
||||
import numpy as np
|
||||
from cv2 import imread, cvtColor, COLOR_BGR2GRAY, imshow, waitKey
|
||||
from cv2 import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
|
||||
|
||||
from digital_image_processing.filters.convolve import img_convolve
|
||||
|
||||
|
||||
|
@ -6,10 +6,9 @@ Created on Fri Sep 28 15:22:29 2018
|
||||
import copy
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
|
||||
import cv2
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
|
||||
class contrastStretch:
|
||||
|
@ -1,6 +1,6 @@
|
||||
""" Multiple image resizing techniques """
|
||||
import numpy as np
|
||||
from cv2 import imread, imshow, waitKey, destroyAllWindows
|
||||
from cv2 import destroyAllWindows, imread, imshow, waitKey
|
||||
|
||||
|
||||
class NearestNeighbour:
|
||||
|
@ -1,6 +1,6 @@
|
||||
from matplotlib import pyplot as plt
|
||||
import numpy as np
|
||||
import cv2
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
|
||||
def get_rotation(
|
||||
|
@ -1,8 +1,7 @@
|
||||
"""
|
||||
Implemented an algorithm using opencv to tone an image with sepia technique
|
||||
"""
|
||||
|
||||
from cv2 import imread, imshow, waitKey, destroyAllWindows
|
||||
from cv2 import destroyAllWindows, imread, imshow, waitKey
|
||||
|
||||
|
||||
def make_sepia(img, factor: int):
|
||||
|
@ -1,21 +1,21 @@
|
||||
"""
|
||||
PyTest's for Digital Image Processing
|
||||
"""
|
||||
|
||||
import digital_image_processing.edge_detection.canny as canny
|
||||
import digital_image_processing.filters.gaussian_filter as gg
|
||||
import digital_image_processing.filters.median_filter as med
|
||||
import digital_image_processing.filters.sobel_filter as sob
|
||||
import digital_image_processing.filters.convolve as conv
|
||||
import digital_image_processing.change_contrast as cc
|
||||
import digital_image_processing.convert_to_negative as cn
|
||||
import digital_image_processing.sepia as sp
|
||||
import digital_image_processing.dithering.burkes as bs
|
||||
import digital_image_processing.resize.resize as rs
|
||||
from cv2 import imread, cvtColor, COLOR_BGR2GRAY
|
||||
from cv2 import COLOR_BGR2GRAY, cvtColor, imread
|
||||
from numpy import array, uint8
|
||||
from PIL import Image
|
||||
|
||||
from digital_image_processing import change_contrast as cc
|
||||
from digital_image_processing import convert_to_negative as cn
|
||||
from digital_image_processing import sepia as sp
|
||||
from digital_image_processing.dithering import burkes as bs
|
||||
from digital_image_processing.edge_detection import canny as canny
|
||||
from digital_image_processing.filters import convolve as conv
|
||||
from digital_image_processing.filters import gaussian_filter as gg
|
||||
from digital_image_processing.filters import median_filter as med
|
||||
from digital_image_processing.filters import sobel_filter as sob
|
||||
from digital_image_processing.resize import resize as rs
|
||||
|
||||
img = imread(r"digital_image_processing/image_data/lena_small.jpg")
|
||||
gray = cvtColor(img, COLOR_BGR2GRAY)
|
||||
|
||||
|
Reference in New Issue
Block a user