资源简介
图像特征提取代码,包括LBP、HOG、Haar、Zernike矩、Hu矩特征,.h文件有如何调用的详细说明,C/OpenCV程序
代码片段和文件信息
#include “stdafx.h“
#include “HaarFeature.h“
#pragma once
#include “.\\include\cv.h“
#include “.\\include\highgui.h“
#include “.\\include\cxcore.h“
#pragma once
#pragma comment(lib“cv210.lib“)
#pragma comment(lib“highgui210.lib“)
#pragma comment(lib“cxcore210.lib“)
HaarFeature::HaarFeature()
{
IntgData = NULL;
HaarVec = NULL;
imageSize.x=0;
imageSize.y=0;
FeatureLength = 0;
HaarFeatureLength =0;
}
HaarFeature::~HaarFeature()
{
ReleaseMemIntgImg();
ReleaseMemFeaVec();
}
bool HaarFeature::ReleaseMemIntgImg()
{
if(IntgData!=NULL)
{
free(IntgData);
IntgData=NULL;
}
return true;
}
bool HaarFeature::AllocMemIntgImg()
{
ReleaseMemIntgImg();
if(imageSize.x==0||imageSize.y==0)
return false;
IntgData = (double*)calloc(imageSize.x*imageSize.ysizeof(double));
return true;
}
bool HaarFeature::ReleaseMemFeaVec()
{
if(HaarVec!=NULL)
{
free(HaarVec);
HaarVec=NULL;
}
return true;
}
bool HaarFeature::AllocMemFeaVec()
{
ReleaseMemFeaVec();
if(HaarFeatureLength==0)
return false;
HaarVec = (double*)calloc(HaarFeatureLengthsizeof(double));
return true;
}
void HaarFeature::CalcIntgImg(IplImage *image)
{
AllocMemIntgImg();
double *pData = IntgData;
//转Gray
IplImage *imageGray = cvCreateImage(cvSize(image->widthimage->height)81);
if(image->nChannels==3)
cvCvtColor(imageimageGrayCV_BGR2GRAY);
else
cvCopy(imageimageGray);
///////第一行////
double count(0);
for(int i=0;i {
count += ((uchar*)(imageGray->imageData))[i];
*pData++ = count;
}
//////后面各行/////
double *pPreData;
for(int i=1;i {
pPreData = pData - imageSize.x;
count = 0;
for(int j=0;j {
count += ((uchar*)(imageGray->imageData + imageGray->widthStep*i))[j];
*pData++ = *pPreData++ + count;
}
}
cvReleaseImage(&imageGray);
}
/////////////////////////////////////////////////////////////////////////////////
void HaarFeature::GetFeatures()
{
GetFeatureLength();
AllocMemFeaVec();
double *pFeatures = HaarVec;
double *pInterData = IntgData;
int FeatureType;
POINT FeatureStPos FeatureScale;
long feaCount = 0;
FeatureStPos.y = 1;
while (FeatureStPos.y < imageSize.y-1)//行扫描
{
FeatureStPos.x = 1;
while (FeatureStPos.x < imageSize.x-1)//列扫描
{
//====== 计算A类特征 ======
FeatureScale.y = 2;
FeatureType = 0;
while (FeatureStPos.y + FeatureScale.y < imageSize.y)//特征y方向放大
{
FeatureScale.x = 2;
while (FeatureStPos.x + 2 * FeatureScale.x < imageSize.x)//特征x方向放大
{
pFeatures[feaCount] = GetOneFeatureValue(FeatureType FeatureStPos FeatureScalepInterData);
feaCount++;
FeatureScale.x ++;
}
FeatureScale.y ++;
}
//========= 计算B类特征 ==========
FeatureScale.y = 2;
FeatureType = 1;
while (FeatureStPos.y + 2 * FeatureScale.y < imageSize.y)//特征y方向放大
{
FeatureScale.x
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 13178 2015-07-24 15:06 HaarFeature.cpp
文件 1871 2015-11-04 17:56 HaarFeature.h
文件 15817 2015-07-29 10:42 HOG.cpp
文件 3348 2015-11-04 17:55 HOG.h
文件 29715 2015-07-21 14:34 LBP.CPP
文件 4025 2015-11-04 17:56 LBP.H
文件 9439 2015-07-22 10:11 MomentFeature.cpp
文件 2731 2015-11-04 17:55 MomentFeature.h
----------- --------- ---------- ----- ----
80124 8
相关资源
- opencv_haartraining.exe 和opencv_createsample
-
opencv 训练 xm
l文件 haar - Hogan阻抗控制第一部
- opencv_createsamples.exe
- Matalbpso优化bp网络程序-PSO-bp.rar
- 尺度FAST结合改进LBP的特征匹配方法
-
haarcascade_frontalface_default.xm
l - HOG+SVM读取样本路径批处理文件
- 采用haar小波实现一维信号的分解与重
- SVM+HOG+LBP
- haarcascade_frontalface_default.rar
- LBP算法应用
- haarcascade_mcs_mouth2019.rar
- 2.4.9版本的opencv_createsamples.exe和openc
- 倾斜haar-like feature计算
- SVM+HOG (行人、车辆等检测)
- Opencv行人检测代码 自带hog检测
- camshift+kalman+LBP特征目标跟随算法实现
- 人脸识别需要的haarcascade_frontalface_d
- convert_cascade
- opencv_haartraining等可执行文件
- haarcascades.rar
- RhoGDIα negatively regulates the glioma
- hog+svm行人检测算法
-
haarcascade_frontalface_alt.xm
l分类器 - 人脸检测训练好的分类器文件haarcas
- 佳能打印机墨盒清零工具
- 佳能LBP-2900打印机驱动,win764位系统
- Canon LBP2900 打印机驱动win10 x64 64位
-
haarcascade_eye.xm
l
评论
共有 条评论