当前位置: 首页>>代码示例>>Python>>正文


Python cv2.HOGDescriptor方法代码示例

本文整理汇总了Python中cv2.HOGDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Python cv2.HOGDescriptor方法的具体用法?Python cv2.HOGDescriptor怎么用?Python cv2.HOGDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cv2的用法示例。


在下文中一共展示了cv2.HOGDescriptor方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_hog

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def get_hog() : 
    winSize = (20,20)
    blockSize = (10,10)
    blockStride = (5,5)
    cellSize = (10,10)
    nbins = 9
    derivAperture = 1
    winSigma = -1.
    histogramNormType = 0
    L2HysThreshold = 0.2
    gammaCorrection = 1
    nlevels = 64
    signedGradient = True

    hog = cv2.HOGDescriptor(winSize,blockSize,blockStride,cellSize,nbins,derivAperture,winSigma,histogramNormType,L2HysThreshold,gammaCorrection,nlevels, signedGradient)

    return hog
    affine_flags = cv2.WARP_INVERSE_MAP|cv2.INTER_LINEAR 
开发者ID:hoanglehaithanh,项目名称:Traffic-Sign-Detection,代码行数:20,代码来源:classification.py

示例2: get_hog

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def get_hog():
    """ Get hog descriptor """

    # cv2.HOGDescriptor(winSize, blockSize, blockStride, cellSize, nbins, derivAperture, winSigma, histogramNormType,
    # L2HysThreshold, gammaCorrection, nlevels, signedGradient)
    hog = cv2.HOGDescriptor((SIZE_IMAGE, SIZE_IMAGE), (8, 8), (4, 4), (8, 8), 9, 1, -1, 0, 0.2, 1, 64, True)
    print("hog descriptor size: '{}'".format(hog.getDescriptorSize()))
    return hog 
开发者ID:PacktPublishing,项目名称:Mastering-OpenCV-4-with-Python,代码行数:10,代码来源:knn_handwritten_digits_recognition_k_training_testing_preprocessing_hog.py

示例3: turn_hog_desc

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def turn_hog_desc(old: np.ndarray) -> np.ndarray:
    fd, _ = hog(
        old,
        orientations=8,
        pixels_per_cell=(16, 16),
        cells_per_block=(1, 1),
        block_norm="L2-Hys",
        visualize=True,
    )

    # also available with opencv-python
    # hog = cv2.HOGDescriptor()
    # return hog.compute(old)
    return fd 
开发者ID:williamfzc,项目名称:stagesepx,代码行数:16,代码来源:toolbox.py

示例4: __init__

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def __init__(self, flip = True):
        self.vs = PiVideoStream(resolution=(800, 608)).start()
        self.flip = flip
        time.sleep(2.0)
        
        self.hog = cv2.HOGDescriptor()
        self.hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector()) 
开发者ID:isaaxug,项目名称:study-picamera-examples,代码行数:9,代码来源:pedestrian_detector.py

示例5: BB_init

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def BB_init(self):
        # use HOG method to initialize bounding box
        self.hog = cv2.HOGDescriptor()
        self.hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
        
        self._box_init_window_name = 'Bounding Box Initialization'
        cv2.namedWindow(self._box_init_window_name)
        cv2.setMouseCallback(self._box_init_window_name, self._on_mouse) 
开发者ID:XinArkh,项目名称:VNect,代码行数:10,代码来源:benchmark.py

示例6: __init__

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def __init__(self):
        print('Initializing HOGBox...')
        self.hog = cv2.HOGDescriptor()
        self.hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
        self._box_init_window_name = 'Click mouse to initialize bounding box'
        cv2.namedWindow(self._box_init_window_name)
        cv2.setMouseCallback(self._box_init_window_name, self.on_mouse)
        print('HOGBox initialized.') 
开发者ID:XinArkh,项目名称:VNect,代码行数:10,代码来源:hog_box.py

示例7: __init__

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def __init__(self):
        self.cap = scorer.VideoCapture(0)
        self.hog = cv2.HOGDescriptor()
        self.hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector()) 
开发者ID:treasure-data,项目名称:treasure-boxes,代码行数:6,代码来源:pedestrian_detector.py

示例8: get_hog

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def get_hog():
    """ Get hog descriptor """

    # cv2.HOGDescriptor(winSize, blockSize, blockStride, cellSize, nbins, derivAperture, winSigma, histogramNormType,
    # L2HysThreshold, gammaCorrection, nlevels, signedGradient)
    hog = cv2.HOGDescriptor((SIZE_IMAGE, SIZE_IMAGE), (8, 8), (4, 4), (8, 8), 9, 1, -1, 0, 0.2, 1, 64, True)

    print("get descriptor size: {}".format(hog.getDescriptorSize()))

    return hog 
开发者ID:PacktPublishing,项目名称:Mastering-OpenCV-4-with-Python,代码行数:12,代码来源:svm_handwritten_digits_recognition_preprocessing_hog_c_gamma.py

示例9: get_hog

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def get_hog():
    """Get hog descriptor"""

    # cv2.HOGDescriptor(winSize, blockSize, blockStride, cellSize, nbins, derivAperture, winSigma, histogramNormType,
    # L2HysThreshold, gammaCorrection, nlevels, signedGradient)
    hog = cv2.HOGDescriptor((SIZE_IMAGE, SIZE_IMAGE), (8, 8), (4, 4), (8, 8), 9, 1, -1, 0, 0.2, 1, 64, True)

    print("get descriptor size: {}".format(hog.getDescriptorSize()))

    return hog 
开发者ID:PacktPublishing,项目名称:Mastering-OpenCV-4-with-Python,代码行数:12,代码来源:svm_handwritten_digits_recognition_preprocessing_hog.py

示例10: __init__

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def __init__(self, storage):
        super(HOG, self).__init__(storage)
        self.STORAGE_SUB_NAME = 'hog_normalized'

        self.sub_folder = self.storage.get_sub_folder(
            self.STORAGE_SUPER_NAME, self.STORAGE_SUB_NAME)
        self.storage.ensure_dir(self.sub_folder)

        self.hog = cv2.HOGDescriptor()
        self.base_size = 256 
开发者ID:yassersouri,项目名称:omgh,代码行数:12,代码来源:hog_extractor.py

示例11: __init__

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def __init__(self):
        self.hog = cv2.HOGDescriptor()
        self.hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
        self.winStride = g.config['stride']
        self.padding = g.config['padding']
        self.scale = float(g.config['scale'])
        self.meanShift = True if int(g.config['mean_shift']) > 0 else False
        g.logger.debug('Initializing HOG') 
开发者ID:dlandon,项目名称:zoneminder,代码行数:10,代码来源:hog.py

示例12: func

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import HOGDescriptor [as 别名]
def func(path):    
    frame = cv2.imread(path)
    frame = cv2.resize(frame,(128,128))
    converted2 = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    converted = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) # Convert from RGB to HSV
    #cv2.imshow("original",converted2)

    lowerBoundary = np.array([0,40,30],dtype="uint8")
    upperBoundary = np.array([43,255,254],dtype="uint8")
    skinMask = cv2.inRange(converted, lowerBoundary, upperBoundary)
    skinMask = cv2.addWeighted(skinMask,0.5,skinMask,0.5,0.0)
    #cv2.imshow("masked",skinMask)
    
    skinMask = cv2.medianBlur(skinMask, 5)
    
    skin = cv2.bitwise_and(converted2, converted2, mask = skinMask)
    #frame = cv2.addWeighted(frame,1.5,skin,-0.5,0)
    #skin = cv2.bitwise_and(frame, frame, mask = skinMask)

    #skinGray=cv2.cvtColor(skin, cv2.COLOR_BGR2GRAY)
    
    #cv2.imshow("masked2",skin)
    img2 = cv2.Canny(skin,60,60)
    #cv2.imshow("edge detection",img2)
    
    ''' 
    hog = cv2.HOGDescriptor()
    h = hog.compute(img2)
    print(len(h))
    
    '''
    surf = cv2.xfeatures2d.SURF_create()
    #surf.extended=True
    img2 = cv2.resize(img2,(256,256))
    kp, des = surf.detectAndCompute(img2,None)
    #print(len(des))
    img2 = cv2.drawKeypoints(img2,kp,None,(0,0,255),4)
    #plt.imshow(img2),plt.show()
    
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    print(len(des))
    return des 
开发者ID:imRishabhGupta,项目名称:Indian-Sign-Language-Recognition,代码行数:45,代码来源:surf_image_processing.py


注:本文中的cv2.HOGDescriptor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。