Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

How to extract a feature from OpenCV instead of skimage?

$
0
0
I'd like to use `import cv2` instead of `from skimage import feature` with **local_binary_pattern** because GPU doesn't support skimage library and I need to use it in real-time which requires high frame per second. Full my code: # import the necessary packages from skimage import feature import numpy as np # import cupy as np class LocalBinaryPatterns: def __init__(self, numPoints, radius): # store the number of points and radius self.numPoints = numPoints self.radius = radius def describe(self, image, eps=1e-7): # compute the Local Binary Pattern representation # of the image, and then use the LBP representation # to build the histogram of patterns lbp = feature.local_binary_pattern(image, self.numPoints, self.radius, method="uniform") (hist, _) = np.histogram(lbp.ravel(), bins=np.arange(0, self.numPoints + 3), range=(0, self.numPoints + 2)) # normalize the histogram hist = hist.astype("float") hist /= (hist.sum() + eps) # return the histogram of Local Binary Patterns return hist For **copyright**, you can get it [here](https://www.pyimagesearch.com/2015/12/07/local-binary-patterns-with-python-opencv/) Please help me or any suggestions? Thank you in advance!

Viewing all articles
Browse latest Browse all 2088

Trending Articles