OpenCV 3.0-HOGDescriptor :: compute()代码示例 [英] OpenCV 3.0 - HOGDescriptor::compute() code example

查看:627
本文介绍了OpenCV 3.0-HOGDescriptor :: compute()代码示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些是OpenCV3.0中HOGDescriptor C'tor和方法compute()的签名:

These are the signatures of HOGDescriptor C'tor and method compute() in OpenCV3.0:

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

有人有示例代码或关于如何为整个图片计算一个矢量的想法吗?

Does anyone have an example code or an idea of how to compute one vector for THE WHOLE image?

推荐答案

下面的一小部分应该可以解决您的问题:

The following small piece of could should work for your problem:

// 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提议的用于检测行人的最佳描述符.

but please note that this descriptor will be larger than the descriptor used proposed to be optimal by Dalal and Triggs for detecting pedestrians.

这篇关于OpenCV 3.0-HOGDescriptor :: compute()代码示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆