Dlib提取Hog特征
来源:互联网 发布:sql合计列 编辑:程序博客网 时间:2024/05/19 20:20
效果如图…
关键点:
1.设置cell大小
2.其他的看代码
3.Dlib配置见: 地址
代码:
#include <dlib/gui_widgets.h>#include <dlib/image_io.h>#include <dlib/image_transforms.h>using namespace std;using namespace dlib;// ----------------------------------------------------------------------------int main(){try{array2d<rgb_pixel> img;//只能是BMP,如果想要JPG之类的,需要编译Dlib让其支持…load_image(img,"C:\\Users\\zhumingde\\Pictures\\timg.bmp");//400*362//单个hog特征是31维的…array2d<matrix<float, 31, 1> > hog;extract_fhog_features(img, hog,16);//默认为8//左右上下留白么233//如果不整除,进1…//也就是说如果cell为100,,,最终的hog为2*2//提取出的hog特征维度为 (cols/cell-2)*(rows/cell-2)cout << "hog image has " << hog.nr() << " rows and " << hog.nc() << " columns." << endl;//看看Hog特征image_window win(img);image_window winhog(draw_fhog(hog));//点击原图可以找出对应的hog特征// Another thing you might want to do is map between the pixels in img and the// cells in the hog image. dlib provides the image_to_fhog() and fhog_to_image()// routines for this. Their use is demonstrated in the following loop which// responds to the user clicking on pixels in the image img.point p; // A 2D point, used to represent pixel locations.while (win.get_next_double_click(p)){point hp = image_to_fhog(p);cout << "The point " << p << " in the input image corresponds to " << hp << " in hog space." << endl;cout << "FHOG features at this point: " << trans(hog[hp.y()][hp.x()]) << endl;}//另一种格式…dlib::array<array2d<float> > planar_hog;extract_fhog_features(img, planar_hog);system("pause");}catch (exception& e){cout << "exception thrown: " << e.what() << endl;system("pause");}}// ----------------------------------------------------------------------------
阅读全文
0 0
- Dlib提取Hog特征
- Hog特征提取
- Hog特征提取
- Hog特征提取
- 特征提取--hog
- OpenCV提取HOG特征
- hog 图像特征提取
- HOG特征提取
- 特征提取-----HOG
- HOG特征提取
- HOG特征提取
- HOG特征提取分析
- HOG特征提取 matlab
- HOG特征提取原理
- hog特征提取
- matlab 提取HOG特征
- hog特征提取方法
- SIFT与HOG特征提取
- Python 3 爬虫(一) 简单的爬虫
- 机器学习编程之python环境
- Xamarin.Forms 用户界面——控件——布局——LayoutOptions
- 51nod 动态规划教程【矩阵取数】
- java安装和环境变量设置
- Dlib提取Hog特征
- Xamarin.Forms 用户界面——控件——布局——Margin and Padding
- 基于CortexM3 CAN驱动
- Linux 分区方案
- 机器学习及实践
- bitset 用法整理
- 设计模式-策略模式-strategy-python
- Ruby 语法讲解
- IDEA使用--字体、编码和基本设置