當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。