728x90

ref : https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_gradients/py_gradients.html

 

라플라시안 영상, 소벨 x/ 소벨 y 영상

 

 

 

 

 

import numpy as np
import cv2

cap = cv2.VideoCapture(0)
while(True):
    ret, frame = cap.read()
    frame = cv2.flip(frame, 0)
    rsz = cv2.resize(frame, dsize=(320,240))
    gray = cv2.cvtColor(rsz, cv2.COLOR_BGR2GRAY)

    laplacian = cv2.Laplacian(gray,cv2.CV_64F)
    sobelx = cv2.Sobel(gray,cv2.CV_64F,1,0,ksize=5)
    sobely = cv2.Sobel(gray,cv2.CV_64F,0,1,ksize=5)

    res = np.concatenate((laplacian, sobelx, sobely), axis=1)
    cv2.imshow('res',res)
    if cv2.waitKey(20) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()
300x250

'로봇 > 로봇' 카테고리의 다른 글

zumi - 21. 평균 필터  (0) 2020.08.25
zumi - 20. 실시간 mpu 플로팅  (0) 2020.08.25
zumi - 18. 주미 흑백 영상 스트리밍  (0) 2020.08.25
zumi - 17. mpu 데이터 플로팅  (0) 2020.08.25
zumi - 16. raw acc/gyro 받기  (0) 2020.08.25

+ Recent posts