Ejemplo n.º 1
0
int CAdaboostDetection::ObjectDetection(BYTE *pImageArray,int nWidth,int nHeight,CString strCascadeFile)
{
    
   if(!m_bInitial) 
   {
		memset( &m_bih, 0, sizeof( m_bih ) );
		m_bih.biSize     = sizeof( m_bih );
		m_bih.biWidth    = nWidth;
		m_bih.biHeight   = nHeight;
		m_bih.biPlanes   = 1;
		m_bih.biBitCount = 24;

		m_nBPP = m_bih.biBitCount / 8;
		m_nPW = (nWidth * m_nBPP + 3) >> 2 << 2;

		m_image = cvCreateImage( cvSize( nWidth, nHeight ), IPL_DEPTH_8U, m_nBPP );
		m_gray = cvCreateImage( cvSize( nWidth, nHeight), 8, 1 );
		m_small_img = cvCreateImage( cvSize( cvRound(nWidth/m_nscale),
			cvRound(nHeight/m_nscale)),
			8, 1 );
		cvZero( m_image );
		cvZero( m_gray );
		cvZero( m_small_img );
        char *p = CStringToCharArray(strCascadeFile);

		strcpy( m_cxml_name,p );
		cascade = (CvHaarClassifierCascade*)cvLoad( m_cxml_name, 0, 0, 0 );
		storage = cvCreateMemStorage(0);
		m_bInitial = TRUE;
    }
Ejemplo n.º 2
0
void CAddCopyrightInfoDlg::OnBnClickedSubmit()
{
	if(m_Path.Trim()=="")
	{
		MessageBox(_T("请输入路径!"));
		return;
	}
	if(m_Copyright.Trim().GetLength()!=0)
	{
		m_Copyright.Append(L"\r\n");//添加换行
	}
	TCHAR pathItem[MAX_PATH];
	TCHAR pathProject[MAX_PATH];
	wcsncpy_s(pathItem, m_Path.GetBuffer(m_Path.GetLength()), m_Path.GetLength());
	wcsncpy_s(pathProject, pathItem, wcslen(pathItem));
	wcsncat_s(pathItem,L"\\Common7\\IDE\\ItemTemplatesCache", 31);
	wcsncat_s(pathProject, L"\\Common7\\IDE\\ProjectTemplatesCache", 34);
	char* copyright = NULL;
	copyright = CStringToCharArray(m_Copyright);
	if(MyFindFile(pathItem, copyright) && MyFindFile(pathProject, copyright))
	{
		MessageBox(L"添加成功");
	}
	if(copyright!=NULL)
	{
		delete copyright;
		copyright = NULL;
	}
	UpdateData();
}