OpenCV에서 가장자리를 꺼내기 (라플라시안, 소벨, 캐니)
기계 학습에 사용되는 이미지 전처리
컴퓨터가 "그 이미지에 무엇이 찍혀 있는지"를 이해하게 하려면 검출 대상의 윤곽을 그려, 거기에서 특징을 찾아내는 과정이 많이 걸립니다.
그 윤곽을 그리는 부분을 Python+OpenCV로 3개의 방법으로 실시한 결과를 이 기사에서는 게재합니다.
원본 이미지
가공원이 되는 화상은 2개 준비했습니다.
자연과 인간입니다.


코드
이 정도입니다.
edge.pyimport cv2
img = cv2.imread('xxxxxxx.jpg')
# エッジ検出
edge_laplacian = cv2.Laplacian(img, -1)#ラプラシアン
edge_sobel = cv2.Sobel(img, -1, 0, 1)#ソーベル
edge_canny = cv2.Canny(img, 10.0, 200.0)#キャニー
# ファイル書き出し
cv2.imwrite('laplacian.jpg', edge_laplacian)
cv2.imwrite('sobel.jpg', edge_sobel)
cv2.imwrite('canny.jpg', edge_canny)
출력 결과
자연
라플라시안↓

소벨↓

캐니↓

인간
라플라시안↓

소벨↓

캐니↓
Reference
이 문제에 관하여(OpenCV에서 가장자리를 꺼내기 (라플라시안, 소벨, 캐니)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/watalucky/items/915eef6b79f8b9b69483
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
가공원이 되는 화상은 2개 준비했습니다.
자연과 인간입니다.


코드
이 정도입니다.
edge.pyimport cv2
img = cv2.imread('xxxxxxx.jpg')
# エッジ検出
edge_laplacian = cv2.Laplacian(img, -1)#ラプラシアン
edge_sobel = cv2.Sobel(img, -1, 0, 1)#ソーベル
edge_canny = cv2.Canny(img, 10.0, 200.0)#キャニー
# ファイル書き出し
cv2.imwrite('laplacian.jpg', edge_laplacian)
cv2.imwrite('sobel.jpg', edge_sobel)
cv2.imwrite('canny.jpg', edge_canny)
출력 결과
자연
라플라시안↓

소벨↓

캐니↓

인간
라플라시안↓

소벨↓

캐니↓
Reference
이 문제에 관하여(OpenCV에서 가장자리를 꺼내기 (라플라시안, 소벨, 캐니)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/watalucky/items/915eef6b79f8b9b69483
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
import cv2
img = cv2.imread('xxxxxxx.jpg')
# エッジ検出
edge_laplacian = cv2.Laplacian(img, -1)#ラプラシアン
edge_sobel = cv2.Sobel(img, -1, 0, 1)#ソーベル
edge_canny = cv2.Canny(img, 10.0, 200.0)#キャニー
# ファイル書き出し
cv2.imwrite('laplacian.jpg', edge_laplacian)
cv2.imwrite('sobel.jpg', edge_sobel)
cv2.imwrite('canny.jpg', edge_canny)
자연
라플라시안↓

소벨↓

캐니↓

인간
라플라시안↓

소벨↓

캐니↓

Reference
이 문제에 관하여(OpenCV에서 가장자리를 꺼내기 (라플라시안, 소벨, 캐니)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/watalucky/items/915eef6b79f8b9b69483텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)