car_recognizer.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Vision-based-parking-lot-availability-OpenCV 作者: Saar1312 项目源码 文件源码
def getEdges(gray,detector,min_thr=None,max_thr=None):
    """
        Where detector in {1,2,3,4}
        1: Laplacian
        2: Sobelx
        3: Sobely
        4: Canny
        5: Sobelx with possitive and negative slope (in 2 negative slopes are lost) 
    """
    if min_thr is None:
        min_thr = 100
        max_thr = 200
    if detector == 1:
        return cv2.Laplacian(gray,cv2.CV_64F)
    elif detector == 2:
        return cv2.Sobel(gray,cv2.CV_64F,1,0,ksize=-1)
    elif detector == 3:
        return cv2.Sobel(gray,cv2.CV_64F,0,1,ksize=-1)
    elif detector == 4:
        return cv2.Canny(gray,min_thr,max_thr)  # Canny(min_thresh,max_thresh) (threshold not to the intensity but to the
                                                # intensity gradient -value that measures how different is a pixel to its neighbors-)
    elif detector == 5:
        sobelx64f = cv2.Sobel(gray,cv2.CV_64F,1,0,ksize=5)
        abs_sobel64f = np.absolute(sobelx64f)
        return np.uint8(abs_sobel64f)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号