Try Catch exception in OpenCV

Try Catch exception in OpenCV

hi folks

the following code is error in Loading file i want to return the function wiht out Opencv error. here src=cvLoadImage(filename,0); is error but the line does not go to catch statement i want to display the Message or without opencv error quit the application.
char filename[20]="c:\training\10p.bmp";
char filename1[20]="c:\training\11p.bmp";
try
{
src=cvLoadImage(filename,0);
dst=cvLoadImage(filename1,0);
cvNamedWindow("Source",1);
cvShowImage("Source",src);
cvNamedWindow("Dst",1);
cvShowImage("Dst",dst);
dst1=cvCreateImage(cvGetSize(src),IPL_DEPTH_8U,1);
cvSub(src,dst,dst1,0);
cvNamedWindow("Dst1",1);
cvShowImage("Dst1",dst1);
cvWaitKey(0);
return 0;
}
catch(_com_error)
{
//MessageBox("Help","gfg",NULL,MB_ICONERROR | MB_OK);
return 0;
}

plz help urgent

Thanks in Advance
Guna

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.