Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC VC++
Hello,
 

I developed an vc++ application where it has a dependent files like 5 .xml files.
 
It is working fine in my computer where as when i run this .exe in other computer the application is getting struck and not respoding and giving error "unable to find the path" that is unable to access the 5 .xml files.
 
Should i make any changes in the solution. Any other solution where we can resolve this problem.
 
Any suggestions would be appreciated.
 
globally declared xml files are:
 
const char *faceCascadeFilename = "Haarcascade\\haarcascade_frontalface_alt2.xml";
const char *leftEyeCascadeFilename = "Haarcascade\\haarcascade_mcs_lefteye.xml";
const char *rightEyeCascadeFilename = "Haarcascade\\haarcascade_mcs_righteye.xml"  ;
const char *nose_cascade = "Haarcascade\\haarcascade_mcs_nose.xml";
const char *mouth_cascade = "Haarcascade\\haarcascade_mcs_mouth.xml";
 
BOOL CDlg::OnInitDialog() 
{
  EnrollFromCam(CString sString);
  return TRUE;
}
 
void EnrollFromCam(CString sString)
{
faceCascade     = ( CvHaarClassifierCascade *) cvLoad ( faceCascadeFilename,     0, 0, 0 )  ;
 
leftEyeCascade  = ( CvHaarClassifierCascade *) cvLoad ( leftEyeCascadeFilename,  0, 0, 0 )  ;
 
rightEyeCascade = ( CvHaarClassifierCascade *) cvLoad ( rightEyeCascadeFilename, 0, 0, 0 )  ;
 
cascade_nose    = ( CvHaarClassifierCascade *) cvLoad ( nose_cascade,            0, 0, 0 )  ;
 
cascade_mouth   = ( CvHaarClassifierCascade *) cvLoad ( mouth_cascade,           0, 0, 0 )  ;
 
if( !(faceCascade || leftEyeCascade ||cascade_nose||cascade_mouth || rightEyeCascade ) )
{
   MessageBox(NULL, L"ERROR in EnrollFromCam(): Could not load Haar cascade Face detection classifier in "%s".\n", L"Error", 0);
            return;
}
else
{
continue;
}
 

 
}
Posted 8-Jan-13 20:26pm
Kumar 091.2K
Edited 8-Jan-13 21:30pm
v5
Comments
jibesh at 9-Jan-13 3:31am
   
what is inside 'cvLoad' i believe this method is loading your xml file. please provide the contents inside 'cvLoad' or please look for FileOpen , OpenFile like APIs in your code.
Kumar 09 at 9-Jan-13 3:39am
   
cvload() means, Loads object from file. It provides a simple interface to cvRead. After object is loaded, the file storage is closed and all the temporary buffers are deleted. Thus, to load a dynamic structure, such as sequence, contour or graph, one should pass a valid destination memory storage to the function and assign to the "CvHaarClassifierCascade* faceCascade" variable.
jibesh at 9-Jan-13 3:53am
   
One more item have you set the Path Variable in the other PC as suggested by OpenCV forum?
Kumar 09 at 9-Jan-13 4:28am
   
No, should i add the same path which exists in my pc to other pc in the environment variable

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Make sure that you have 5.xml files also copied to the other computer, also check how you get the File Path in your application.
 
Are you using
TCHAR pwd[MAX_PATH];
GetCurrentDirectory(MAX_PATH,pwd); 
to get the File Path?>
 
Read More about Open CV File Load Error
 
To be able to execute the application you'll need to modify the PATH environment variable of your system to add the location of OpenCV's DLLs. Add this to end of PATH:
 
opencv-2-3-c-visual-studio-2010[^]
  Permalink  
v2
Comments
Kumar 09 at 9-Jan-13 2:45am
   
no, should i use this function, if yes where should i use and in which class.
jibesh at 9-Jan-13 2:50am
   
i cannot solve your problem without seeing your code, if you can copy the code block where you loading this 5.xml I can tell where you need to put this code. You can use 'Improve Question' widget at the right bottom of your question to modify it.
 
You must be very clear in asking question because we dont see your computer and we cannot read your mind.
jibesh at 9-Jan-13 3:49am
   
It's the OpenCV methods right. did you maintain the folder structure as same they did in their sample projects?
 
eg:
 
bin\your.exe
Config\Folder2\files
 
I am not familiar with Open CV but I believe if you maintain the same folder structure it will work fine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 254
1 Nirav Prabtani 223
2 Sergey Alexandrovich Kryukov 209
3 _Amy 165
4 Richard MacCutchan 135
0 OriginalGriff 7,799
1 Sergey Alexandrovich Kryukov 6,966
2 Maciej Los 3,994
3 Peter Leow 3,708
4 CHill60 2,742


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100