www.pudn.com > CBVRtest.rar > SBD.cpp


// SBD.cpp: implementation of the SBD class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "stdafx.h" 
#include "CBVRtestsystem.h" 
#include "SBD.h" 
#include "InputDlg.h" 
#ifdef _DEBUG 
#undef THIS_FILE 
static char THIS_FILE[]=__FILE__; 
#define new DEBUG_NEW 
#endif 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
 
SBD::SBD(PGETFRAME g1,int W,int H,int l,int number) 
{ 
	gapgf=g1; 
	m_frameW=W; 
	m_frameH=H; 
	length=l; 
	sb=new int[length]; 
	D=new float[length]; 
	memset(sb,0,length*sizeof(int)); 
	memset(D,0,length*sizeof(float)); 
	if (number==1)  
	{ 
		sbd1(); 
	} 
	if (number==2)  
	{ 
		sbd2(); 
	} 
 
} 
 
//基于象素的镜头边界检测 
void SBD::sbd1() 
{ 
	InputDlg sbd1dlg; 
	float threshold; 
	int i,j=0;  
	for(i=1;ithreshold)  
		{ 
			sb[j++]=i-1; 
		} 
	} 
	sbnumber=j; 
} 
 
//基于直方图的镜头边界检测 
void SBD::sbd2() 
{ 
	InputDlg sbd2dlg; 
	float threshold; 
	int i,j=0;  
	m_HSVframe1.SetHSV(12,5,5); 
	m_HSVframe2.SetHSV(12,5,5); 
	for(i=1;ithreshold)  
		{ 
			sb[j++]=i-1; 
		} 
	} 
	sbnumber=j;	 
} 
 
 
 
 
//两帧RGB图像象素比较 
float SBD::CompFrameByRGBPixel(MyRGB f1, MyRGB f2) 
{ 
	float total=0; 
	for(int i=0;i