资源简介
C++代码提取LBP特征,一共包括两种方式normal和circle,circle的效果好
代码片段和文件信息
#include
//#include
#include
#include
#include
#include
const static int lbpBins = 14;
static float lbpSquare[lbpBins + 1][lbpBins + 1];
using namespace cv;
using namespace std;
void elbp(Mat& src Mat &dst int radius int neighbors)
{
for(int n=0; n {
float x = static_cast(-radius * sin(2.0*CV_PI*n/static_cast(neighbors)));
float y = static_cast(radius * cos(2.0*CV_PI*n/static_cast(neighbors)));
int fx = static_cast(floor(x));
int fy = static_cast(floor(y));
int cx = static_cast(ceil(x));
int cy = static_cast(ceil(y));
float ty = y - fy;
float tx = x - fx;
float w1 = (1 - tx) * (1 - ty);
float w2 = tx * (1 - ty);
float w3 = (1 - tx) * ty;
float w4 = tx * ty;
for(int i=radius; i < src.rows-radius;i++)
{
for(int j=radius;j < src.cols-radius;j++)
{
float t = static_cast(w1*src.at(i+fyj+fx) + w2*src.at(i+fyj+cx) + w3*src.at(i+cyj+fx) + w4*src.at(i+cyj+cx));
dst.at(i-radiusj-radius) += ((t > src.at(ij)) || (std::abs(t-src.at(ij)) < std::numeric_limits::epsilon())) << n;
}
}
}
dst.create(1 lbpBins * lbpBins CV_32FC1);
for (int b = 0; b < lbpBins; b++)
{
for (int c = 0; c < lbpBins; c++)
{
相关资源
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
- VC++基于OpenGL模拟的一个3维空间模型
评论
共有 条评论