91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 28KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-15
  • 語言: C/C++
  • 標簽:

資源簡介

該代碼實現了boosting算法的每一條步驟,用C++語言實現,比較完整。

資源截圖

代碼片段和文件信息

//?Boosting.cpp:?implementation?of?the?Boosting?class.
//
//////////////////////////////////////////////////////////////////////
#include?“stdafx.h“
#include?“BoostingLbp.h“
#include?“Boosting.h“
#include?“math.h“
#include?“stdio.h“
#include?“Define.h“
#include?“HarrFeature.h“
#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]=__FILE__;
#define?new?DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
Boosting::Boosting(DWORD?posNum?DWORD?negNum)
{
????????PositiveNum?=?posNum;
????????NegativeNum?=?negNum;
????????TotalNegativeNum?=?negNum;
????????TotalSampleNum?=?PositiveNum?+?NegativeNum;

????????unsigned?char?*pFlag?=?new?unsigned?char[TOTAL_FEATURE_NUM];
????????// FILE?*fFlag?=?fopen(SAVEPATH?+?“flag“?“rb“);
????????// fread(pFlag?sizeof(unsigned?char)?TOTAL_FEATURE_NUM?fFlag);
????????// fclose(fFlag);
????????memset(pFlag?1?TOTAL_FEATURE_NUM);

????????usedFeaCount?=?0;
????????for?(int?c=0;?c????????{
????????????????if?(pFlag[c]?==?1)?usedFeaCount++;
????????}
????????delete?[]pFlag;

????????BinMin?=?NULL;
????????BinWidth?=?NULL;
????????FeaValue?=?NULL;
????????subWinInfo?=?new?FeatureInfo[usedFeaCount];

????????Weight?=?new?double[TotalSampleNum];

????????VotedValue?=?new?double[TotalSampleNum];

????????Label?=?new?unsigned?char[TotalSampleNum];

????????memset(Label?1??PositiveNum);
????????memset(Label?+?PositiveNum?0?NegativeNum);
}

Boosting::~Boosting()
{
????????delete?[]BinMin;
????????BinMin?=?NULL;
????????delete?[]BinWidth;
????????BinWidth?=?NULL;

????????delete?[]Weight;
????????Weight?=?NULL;

????????delete?[]VotedValue;
????????VotedValue?=?NULL;

????????delete?[]Label;
????????Label?=?NULL;

????????if?(NULL?!=?FeaValue)
????????{
????????????????for(int?i=0;?i????????????????{
????????????????????????if(FeaValue[i]?!=?NULL)?
????????????????????????{
????????????????????????????????delete?[]?FeaValue[i];
????????????????????????????????FeaValue[i]?=?NULL;
????????????????????????}
????????????????}
????????????????FeaValue?=?NULL;
????????}

????????if?(subWinInfo?!=?NULL)?delete?[]subWinInfo;

????????return;
}

//Quantize?and?the?LBP?bin?distance.
void?Boosting::Init(CString?szPosName?CString?szNegName)
{
????????GetAllSubWinInfo();

????????printf(“\n“);
????????printf(“Total?Weak?Learner:?%d\n“?usedFeaCount);
????????printf(“Positive?Sample?Number:?%d\n“?PositiveNum);
????????printf(“Negative?Sample?Number:?%d\n“?NegativeNum);
????????printf(“\n“);

????????CString?szPosPath?=?szPosName;
????????CString?szNegPath?=?szNegName;

????????FILE?*PosFile?=?fopen(szPosPath?“rb“);
????????FILE?*NegFile?=?fopen(szNegPath?“rb“);

????????//Quantize?the?distance?to?be?between?0?and?99.
????????BinMin???=?new?doubl

評論

共有 條評論

相關資源