[code cpp]
//Exec Notepad
CFileFind ff;
//if( ff.FindFile( _T("C:\\WINDOWS\\notepad.exe") ) && ff.FindFile( _T("C:\\TEST\\temp.txt") ) )
// WinExec( "C:\\WINDOWS\\notepad.exe C:\\PARMI\\temp.txt", SW_SHOW );if( ff.FindFile( _T("C:\\WINDOWS\\notepad.exe") ) && ff.FindFile( strFilePath ) )
{
CString strCmd;
strCmd.Format( _T("C:\\WINDOWS\\notepad.exe ") );
strCmd += strFilePath; USES_CONVERSION;
WinExec( W2A(strCmd), SW_SHOW );
}
[/code] [code cpp]
//Show Image
void cvShowImageWindow(CString title, CvArr* image)
{ USES_CONVERSION;
cvNamedWindow( W2A(title), CV_WINDOW_AUTOSIZE);
cvShowImage( W2A(title), image); HWND hWnd = ::FindWindow(NULL, title);
if (hWnd)
::SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); }
[/code] [code cpp]
//Save Image
CString strFileName;
std::string szFileName = CStringA( strFileName );
cvSaveImage( szFileName.c_str(), iplImage );
[/code]
[code cpp] //////////////////////////////////////////////////////////////////////////
//cvFitLine
int nCount = (int)m_vPtList.size();
CvPoint2D32f* points = (CvPoint2D32f*)malloc( nCount * sizeof(CvPoint2D32f) ); for(int i=0; i<nCount; i++)
{
INFO _Data = m_vPtList.at(i);
points[i].x = (float)_Data.X;
points[i].y = (float)_Data.Y;
} CvMat cvmData = cvMat( 1, nCount, CV_32FC2, points );
float LineParam[4]; //[0:Vx] [1:Vy] [2:X0] [3:Y0]
cvFitLine( &cvmData, CV_DIST_HUBER, 0.1, 0.0001, 0.0001, LineParam );
free( points ); //Y = ax + b;
double a, b;
a = (double)LineParam[1] / (double)LineParam[0]; //θ
b = (double)LineParam[3] - a * (double)LineParam[2]; //ρ [/code]
댓글
댓글 쓰기