这些是OpenCV3.0中HOGDescriptor
C'tor和方法compute()
的签名:
HOGDescriptor (Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize,
int _nbins, int _derivAperture=1, double _winSigma=-1,
int _histogramNormType=HOGDescriptor::L2Hys, double _L2HysThreshold=0.2,
bool _gammaCorrection=false, int _nlevels=HOGDescriptor::DEFAULT_NLEVELS,
bool _signedGradient=false)
virtual void compute (InputArray img, std::vector< float > &descriptors,
Size winStride=Size(), Size padding=Size(),
const std::vector< Point > &locations=std::vector< Point >()) const
有没有人有示例代码或关于如何为计算整个图像的 vector 的想法?
最佳答案
以下一小部分应该可以解决您的问题:
// create descriptor object and set the size of the hog descriptor to image size
cv::HOGDescriptor hog;
hog.winSize = grayImg.size();
// set the descriptor position to the middle of the image
std::vector<cv::Point> positions;
positions.push_back(cv::Point(grayImg.cols / 2, grayImg.rows / 2));
std::vector<float> descriptor;
hog.compute(grayImg,descriptor,cv::Size(),cv::Size(),positions);
但请注意,该描述符将大于Dalal和Triggs提出的用于检测行人的最佳描述符。
关于opencv - OpenCV 3.0-HOGDescriptor::compute()代码示例,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33595328/