2 u012328692 u012328692 于 2014.03.11 17:00 提问

在读文件infile的时候出现的问题 请大神看看啊 困扰两天了。。。。。。。。

代码如下,编译的时候不会出错,但是点击按钮就会死程序,注释掉bianhuanbianliang也就是消息响应函数倒数第二行的时候不会出错,这个函数中只有存在infile》就会在void* CMapPtrToPtr::GetValueAt(void* key) const这个函数里出错!这是什么函数?求解释啊
void CControlPane::OnBnClickedCamcalib()
{
// TODO: 在此添加控件通知处理程序代码
/*相机标定*/
CString inputdata,inputdata1 ;
inputdata.Format("E:\all_points_camera.dat");
LPTSTR camerainput,projectorinput;
camerainput=inputdata.GetBuffer(inputdata.GetAllocLength());

CString  calib_result ;
//calib_result.Format("E:\\jcdata\\camera calibration result.dat");
calib_result.Format("E:\\camera calibration result.dat");

LPTSTR cameraoutput;
cameraoutput=calib_result.GetBuffer(calib_result.GetAllocLength());
initialize_photometrics_parms(1032,779,0.00465,0.00465);
load_cd_data (camerainput);

noncoplanar_calibration_with_full_optimization();
print_cp_cc_data (cameraoutput);
print_error_stats (cameraoutput);
CCameraView* camview=(CCameraView*)GetCameraViewPoint();
camview->kaka_Translate();
camview->BianHuanBianLiang();
AfxMessageBox("111");

}

void CCameraView::BianHuanBianLiang(void)
{
double Rx,Ry,Rz;
ifstream infile;
infile.open("E:\jcdata\ccp.dat",ios::in);
infile>>cam_dx>>cam_dy>>cam_Nfx>>cam_Ncx>>Cx>>Cy>>f>>k>>Sx>>Rx>>Ry>>Rz>>Tx>>Ty>>Tz;
double sa,ca,sb,cb,sg,cg;
SINCOS (Rx, sa, ca);
SINCOS (Ry, sb, cb);
SINCOS (Rz, sg, cg);

r1 = cb * cg;
r2 = cg * sa * sb - ca * sg;
r3 = sa * sg + ca * cg * sb;
r4 = cb * sg;
r5 = sa * sb * sg + ca * cg;
r6 = ca * sb * sg - cg * sa;
r7 = -sb;
r8 = cb * sa;
r9 = ca * cb;

infile.close();
cvSetReal2D(K,0,0,f/cam_dx);
cvSetReal2D(K,0,1,0);
cvSetReal2D(K,0,2,Cx);
cvSetReal2D(K,1,0,0);
cvSetReal2D(K,1,1,f/cam_dy);
cvSetReal2D(K,1,2,Cy);
cvSetReal2D(K,2,0,0);
cvSetReal2D(K,2,1,0);
cvSetReal2D(K,2,2,1);

}

Csdn user default icon
上传中...
上传图片
插入图片