Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 백준
- 백준알고리즘
- Windows10
- 턱걸이
- linux
- 알고리즘
- 코딩
- Computer Vision
- 딥러닝
- 공부
- C++
- C언어
- 학습
- 텐서플로우
- shell
- 리눅스
- 회귀
- 시스템프로그래밍
- 쉘
- TensorFlow
- Windows 10
- OpenCV
- 영상처리
- c
- 운영체제
- 프로그래밍
- 프로세스
- error
- CV
- python
Archives
- Today
- Total
줘이리의 인생적기
CV - opencv(Python) Canny Edge 본문
728x90
Canny Edge에 대해 알아보겠습니다.
-1986년 제안된 알고리즘
-모든 경계선 검출 가능
-경계선 위치 정확히 측정 가능
-구현순서 : 가우시안필터로 노이즈 제거 -> sobel mask를 통한 경계선 검출 -> Non maximum suppression -> Double thresholding
Canny Edge
threshold1은 약한 경계선에 대한 값
threshold2는 강한 경게선에 대한 값
코드 원형 설명
def cannyEdge(image, threshold1=100, threshold2=200):
return cv2.Canny(image, threshold1, threshold2)
코드 설명
더보기
from OpenCV_Functions import *
def nothing(x):
pass
#이미지 설정
imagePath = "<이미지 경로>"
image = imageRead(imagePath)
backup = imageCopy(image)
#창 띄우기
cv2.namedWindow('Canny Edge', cv2.WINDOW_GUI_EXPANDED)
#트랙바 설정
cv2.createTrackbar('threshold1', 'Canny Edge', 0, 200, nothing)
cv2.createTrackbar('threshold2', 'Canny Edge', 100, 400, nothing)
switch = '0:OFF\n1:On'
cv2.createTrackbar(switch, 'Canny Edge', 1, 1, nothing)
while True:
cv2.imshow('Canny Edge', image)
if cv2.waitKey(1) & 0xFF == 27:
break
threshold1 = cv2.getTrackbarPos('threshold1', 'Canny Edge')
threshold2 = cv2.getTrackbarPos('threshold2', 'Canny Edge')
s = cv2.getTrackbarPos(switch, 'Canny Edge')
if s == 1:
image = cannyEdge(backup, threshold1, threshold2)
else:
image = backup
cv2.destroyAllWindows()
'공부 > Computer Vision(py)' 카테고리의 다른 글
CV - opencv(Python) Geometric Transform(설명필요) (0) | 2020.07.23 |
---|---|
CV - opencv(Python) Morphology (0) | 2020.07.22 |
CV - opencv(Python) 경계선 검출(edge detection) (0) | 2020.07.20 |
CV - opencv(Python) Blur, GaussianBlur, MedianBlur (0) | 2020.07.17 |
CV - opencv(Python) addImage, addWeightedImage, imageThreshold (0) | 2020.07.16 |