Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

C++
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
Updated 8-Jan-13 21:30pm
v5
Comments
Jibesh 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 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 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 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

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
C++
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[^]
 
Share this answer
 
v2
Comments
Kumar 09 9-Jan-13 2:45am    
no, should i use this function, if yes where should i use and in which class.
Jibesh 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 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900