/fhog-python

Python wrapper for Piotr's Computer Vision Matlab Toolbox(PDollar Toolbox)

Primary LanguageC++

fhog-python

A python wrapper for the fhog function of PDollar Toolbox. This function is widely used in visual tracking (e.g fDSST, ECO) to extract HOG feature.

Install

python setup.py build_ext --inplace

Usage

import fhog
def fHOG(im_patch):
    M = np.zeros(im_patch.shape[:2], dtype='float32')
    O = np.zeros(im_patch.shape[:2], dtype='float32')
    H = np.zeros([im_patch.shape[0]//4,im_patch.shape[1]//4, 32], dtype='float32') # python3
    fhog.gradientMag(im_patch.astype(np.float32),M,O)
    fhog.gradientHist(M,O,H)
    return H

TODO

  • Fix warning in fhog.cpp:
- DeprecationWarning: NPY_ARRAY_UPDATEIFCOPY, NPY_ARRAY_INOUT_ARRAY, and NPY_ARRAY_INOUT_FARRAY are deprecated, use NPY_WRITEBACKIFCOPY, NPY_ARRAY_INOUT_ARRAY2, or NPY_ARRAY_INOUT_FARRAY2 respectively instead, and call PyArray_ResolveWritebackIfCopy before the array is deallocated, i.e. before the last call to Py_DECREF.
- DeprecationWarning: UPDATEIFCOPY detected in array_dealloc.  Required call to PyArray_ResolveWritebackIfCopy or PyArray_DiscardWritebackIfCopy is missing

References