Python cv2.HOGDescriptor() Examples
The following are 12
code examples of cv2.HOGDescriptor().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
cv2
, or try the search function
.
Example #1
Source File: classification.py From Traffic-Sign-Detection with MIT License | 6 votes |
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
Example #2
Source File: toolbox.py From stagesepx with MIT License | 5 votes |
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
Example #3
Source File: pedestrian_detector.py From study-picamera-examples with MIT License | 5 votes |
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())
Example #4
Source File: benchmark.py From VNect with Apache License 2.0 | 5 votes |
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)
Example #5
Source File: hog_box.py From VNect with Apache License 2.0 | 5 votes |
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.')
Example #6
Source File: pedestrian_detector.py From treasure-boxes with MIT License | 5 votes |
def __init__(self): self.cap = scorer.VideoCapture(0) self.hog = cv2.HOGDescriptor() self.hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
Example #7
Source File: knn_handwritten_digits_recognition_k_training_testing_preprocessing_hog.py From Mastering-OpenCV-4-with-Python with MIT License | 5 votes |
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
Example #8
Source File: svm_handwritten_digits_recognition_preprocessing_hog_c_gamma.py From Mastering-OpenCV-4-with-Python with MIT License | 5 votes |
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
Example #9
Source File: svm_handwritten_digits_recognition_preprocessing_hog.py From Mastering-OpenCV-4-with-Python with MIT License | 5 votes |
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
Example #10
Source File: hog_extractor.py From omgh with MIT License | 5 votes |
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
Example #11
Source File: hog.py From zoneminder with GNU General Public License v2.0 | 5 votes |
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')
Example #12
Source File: surf_image_processing.py From Indian-Sign-Language-Recognition with MIT License | 4 votes |
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