www.pudn.com > ManualCameraCalibrationSourceCode_v1.0.rar > ZhangImplementation_1Dlg.h


/********************************************************************** 
 
Camera Calibration Software v1.0   
Copyright 2004 Engin Tola 
 
-- 
 
Engin Tola  
March 20, 2004 
 
-- 
 
This piece of program contained in Camera Calibration Software v1.0 can be used, 
copied, modified, merged, published, and/or have copies distributed for academic  
or research purposes only without restriction under the following conditions: 
 
1. The above header and this permission notice shall be included in all copies  
    or substantial portions of the program 
 
2. The software is provided "as is", without warranty of any kind, express or  
   implied, including but not limited to the warranties of merchantability, fitness  
   for a particular purpose and non-infringement. In no event shall the author(s) be  
   liable for any claim, damages or liability, whether in an action of contract, tort  
   or otherwise, arising from, out of or in connection with Camera Calibration  
   Software v1.0 or the use or other dealings in Camera Calibration Software v1.0 
 
3. If you use this piece of code for research purposes, refer to  
 
	Tola, Engin. 2006 June 12. Homepage.  
 
4. An acknowledgement note should be included as:  
 
    "The software used here was originally created by Tola, Engin. 2006 June 12.  
	Homepage.  
 
 
**********************************************************************/ 
 
// ZhangImplementation_1Dlg.h : header file 
// 
 
#if !defined(AFX_ZHANGIMPLEMENTATION_1DLG_H__BDBFD19F_84C6_4305_AAFA_49F355ED3E4B__INCLUDED_) 
#define AFX_ZHANGIMPLEMENTATION_1DLG_H__BDBFD19F_84C6_4305_AAFA_49F355ED3E4B__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#include "cv.h"  // include core library interface 
#include "highgui.h" // include GUI library interface 
 
#include "KBasicStructures.h" 
#include "KMathematica.h" 
 
 
typedef KBasicStructures::FileProp FileProp; 
 
///////////////////////////////////////////////////////////////////////////// 
// CZhangImplementation_1Dlg dialog 
 
class CZhangImplementation_1Dlg : public CDialog 
{ 
// Construction 
public: 
	int m_nEffectiveImageNumber; 
 
	CvVect64d m_distortion; 
	CvMatr64d m_cameraMatrix; 
	CvVect64d m_transVects ; 
	CvMatr64d m_rotMatrs; 
 
	CvPoint2D64d* uveff; 
	CvPoint3D64d* XYZeff; 
	 
	int m_nNumCorners; 
 
	CvSize imgsize; 
 
	IplImage** p2p_InputImages; 
 
	FileProp m_ImageRoot; 
 
	~CZhangImplementation_1Dlg(); 
 
	CZhangImplementation_1Dlg(CWnd* pParent = NULL);	// standard constructor 
 
// Dialog Data 
	//{{AFX_DATA(CZhangImplementation_1Dlg) 
	enum { IDD = IDD_ZHANGIMPLEMENTATION_1_DIALOG }; 
	CStatic	m_ctrlTestNo; 
	CProgressCtrl	m_ctrlTestProgress; 
	int		m_nImageNumber; 
	int		m_nXHeight; 
	int		m_nXWidth; 
	double	m_dGridHeight; 
	double	m_dGridWidth; 
	BOOL	m_bDisplayCorners; 
	BOOL	m_bDisplayRT; 
	int		m_nGroupNo; 
	BOOL	m_btnApplyOrder; 
	BOOL    m_bCombination; 
	BOOL	m_bGenerateMFile; 
	BOOL	m_bCompansateDistortion; 
	//}}AFX_DATA 
 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CZhangImplementation_1Dlg) 
	protected: 
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support 
	//}}AFX_VIRTUAL 
 
// Implementation 
protected: 
 
	HICON m_hIcon; 
 
	// Generated message map functions 
	//{{AFX_MSG(CZhangImplementation_1Dlg) 
	virtual BOOL OnInitDialog(); 
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam); 
	afx_msg void OnPaint(); 
	afx_msg HCURSOR OnQueryDragIcon(); 
	afx_msg void OnLoad(); 
	afx_msg void OnCalibrate(); 
	afx_msg void OnLoadSelected(); 
	afx_msg void OnTest(); 
	afx_msg void OnOpenLogFile(); 
	afx_msg void OnDisplCoordinates(); 
	afx_msg void OnTestInputSweepRun(); 
	afx_msg void OnResults(); 
	afx_msg void OnOpenDirectory(); 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
private: 
	CString* m_cstrImageNames; 
 
	CvPoint2D64d m_dErrorPower; 
	CvPoint2D64d m_dErrorMax; 
	CvPoint2D64d m_dErrorMean; 
 
	void FindCorners(); 
	void DisplayReport(); 
	void GenerateReport(); 
	void CalculateCalibrationErrors(bool print); 
	void CalibrateCamera(); 
	void SortPoints(CvPoint2D32f* &points, int n, CvPoint3D32f* init); 
	void SortRespectTo( CvPoint2D32f* &arr, CvPoint2D32f anchor, int n ); 
	CvPoint2D32f CalculateAngleRespectTo(CvPoint2D32f* arr, int n, CvPoint2D32f anchor, int thr1, int thr2=0, bool exact=true ,bool vert=false); 
	CvPoint3D32f FindRectangleCorner(CvPoint2D32f* points, int n); 
}; 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_ZHANGIMPLEMENTATION_1DLG_H__BDBFD19F_84C6_4305_AAFA_49F355ED3E4B__INCLUDED_)