앎을 경계하기

DAFIT 66

<DAFIT> 10 Pytorch를 통한 Classification 입문 - 01 라이브러리 준비, 데이터 전처리

fashion MNIST 데이터셋 TF from tensorflow import keras keras.datasets.fashion_mnist(...) PyTorch from torchvision import datasets datasets.FashionMNIST('~/.pytorch/F_MNIST_data/',...) transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize(mean=0.5, std=0.5) ]) ToTensor() : 텐서로 변환해줌. 0~1로 변경 Normalize(mean=0.5, std=0.5) : -1 ~ 1 사이로 normalize함 grayscale이기 때문에 0.5로 해준다. 만약 3 colo..

<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,..