앎을 경계하기

DAFIT/909 - OpenCV 연습하기 (1) 8

<DAFIT> 09 OpenCV 연습하기(1) - 05 Noise and Filtering(2)

이전글 보기 ▼ 더보기 2019/12/11 - [Study/DAFIT] - 09 OpenCV 연습하기(1) - 06 Edge Detection(1) 09 OpenCV 연습하기(1) - 06 Edge Detection(1) https://docs.opencv.org/3.4/d2/d2c/tutorial_sobel_derivatives.html OpenCV: Sobel Derivatives Prev Tutorial: Adding borders to your images Next Tutorial: Laplace Operator Goal In this tutorial you w.. whereisend.tistory.com 2019/12/10 - [Study/DAFIT] - 09 OpenCV 연습하기(1) - 05..

<DAFIT> 09 OpenCV 연습하기(1) - 07 Edge Detection(2)

이번에는 라플라시안을 사용해서 엣지 검출을 해보자. Sobel operator를 사용해서 라플라시안을 계산한다. Laplacian() 파라미터는 다음과 같다. 여기서 ksize는 1이거나 1보다 큰 홀수이다. ksize는 2차 미분 필터를 계산하는데 사용되는 Aerture size이다. #edge는 픽셀값이 급격하게 변하는 지점이다. #주변보다 1차 미분값이 큰 부분을 엣지로 검출하게된다. #sobel x,y 방향 각각의 별도 커널을 사용해서 엣지 검출한다. #sobel x는 수직선 방향 #sobel y는 수평선 방향 import cv2 from google.colab.patches import cv2_imshow img_path='/content/drive/My Drive/다핏문제/909/l..

<DAFIT> 09 OpenCV 연습하기(1) - 06 Edge Detection(1)

https://docs.opencv.org/3.4/d2/d2c/tutorial_sobel_derivatives.html OpenCV: Sobel Derivatives Prev Tutorial: Adding borders to your images Next Tutorial: Laplace Operator Goal In this tutorial you will learn how to: Use the OpenCV function Sobel() to calculate the derivatives from an image. Use the OpenCV function Scharr() to calculate a more accur docs.opencv.org 가장자리는 급격하게 값이 변하는 곳으로 표현할 수 있다. ..

<DAFIT> 09 OpenCV 연습하기(1) - 05 Noise and Filtering(2)

이미 medianblur를 사용했음. 2019/12/10 - [Study/DAFIT] - 09 OpenCV 연습하기(1) - 04 Noise and Filtering(1) 09 OpenCV 연습하기(1) - 04 Noise and Filtering(1) import numpy as np import cv2 from random import random from google.colab.patches import cv2_imshow import copy img_path = '/content/drive/My Drive/다핏문제/909/lena.jpg' 다음 함수를.. whereisend.tistory.com 그냥 blur와의 차이를 확인해보자. import numpy as np import cv2 ..

<DAFIT> 09 OpenCV 연습하기(1) - 04 Noise and Filtering(1)

import numpy as np import cv2 from random import random from google.colab.patches import cv2_imshow import copy img_path = '/content/drive/My Drive/다핏문제/909/lena.jpg' 다음 함수를 적용해서 이미지에 노이즈를 추가한다. def salt_and_pepper(image, p): output = np.zeros(image.shape,np.uint8) thres = 1 - p for i in range(image.shape[0]): for j in range(image.shape[1]): rdn = random() if rdn < p: output[i][j] = 0 elif..

<DAFIT> 09 OpenCV 연습하기(1) - 03 Sharpening Filter

3x3 커널은 아래와 같은 형태가 되어야함. -1 -1 -1 -1 9 -1 -1 -1 -1 이미지는 사이즈 (256,256), grayscale. import numpy as np import cv2 from google.colab.patches import cv2_imshow 필터 생성 및 이미지 grayscale로 읽기, 사이즈 변환 #Sharpening #3x3 kernel kernel = np.array([[-1,-1,-1],[-1,9,-1],[-1,-1,-1]]) img = cv2.imread('/content/drive/My Drive/다핏문제/909/lena.jpg',2) img = cv2.resize(img,(256,256)) 필터 적용 img = cv2.filter2D(img,..

<DAFIT> 09 OpenCV 연습하기(1) - 02 Blurring Filter

원소 1/9 로 채워진 3x3 필터 : np.full() 사용. 이미지 사이즈는 (256,256), grayscale이다. import cv2 import numpy as np from google.colab.patches import cv2_imshow img_path = '/content/drive/My Drive/다핏문제/909/lena.jpg' img = cv2.imread(img_path,2) img = cv2.resize(img,(256,256)) cv2_imshow(img) kernel = np.full((3,3),1/9) kernel after_img = cv2.filter2D(img, -1, kernel) cv2_imshow(after_img) 약간 블러처리된 느낌의 결과 이미..

<DAFIT> 09 OpenCV 연습하기(1) - 01 Convolution Filter

0~1 사이의 값 : random 값 3x3 커널 : [[a,b,c],[d,e,f,],[g,h,i]] 이미지는 (256,256)으로 resizing하고 grayscale로 변환. * 필요한 라이브러리 임포트 import cv2 from google.colab.patches import cv2_imshow import numpy as np * 이미지 읽기 #cv2.filter2D #0~1 사이 값으로 구성된 3x3 커널을 생성한 뒤 이미지에 적용한 두 이미지를 동시에 출력해보자. #이미지에 적용전 높이 너비를 256,256이고 gray로 변환한다. img_path = '/content/drive/My Drive/다핏문제/909/lena.jpg' img = cv2.imread(img_path,2)..