cv::FileStorage unclear behaviour

asked 2017-12-21 04:39:45 -0600

Finch_the_second gravatar image

updated 2017-12-21 04:41:17 -0600

Hi guys,

I use a C++ programm on my Raspberry Pi for OCR where I use cv::FileStorage to find classification files for kNN.

If i start the programm in the LXTerminal on the raspberry it searches for the classification files in the folder where the program is stored. If i start it from a remote machine using SSH it searches in the /home/pi folder, no matter where the programm is stored.

I am not too familar with Linux and don't really know if its a OpenCV problem or something else. Could you explain me why that happens and do you have any suggestions how to fix it? I want to store the classification files in the same folder as the program.

edit: Same happens with cv:imwrite.

edit retag flag offensive close merge delete

Comments

1

it sounds a bit like your program is run in a different folder, depending on your login/user/shell

can you try to use an absolute path to your files, like /some/folder/myknn.xml ?

(i also do not think, that this is specific to opencv, more a common problem using relative pathes)

berak gravatar imageberak ( 2017-12-21 05:04:03 -0600 )edit

Going into the folder and then executing the program works. So i guess its right what u said.

Finch_the_second gravatar imageFinch_the_second ( 2017-12-21 08:29:16 -0600 )edit

Going into the folder first and then executing the program works. So i guess its right what u said.

Finch_the_second gravatar imageFinch_the_second ( 2017-12-21 08:29:28 -0600 )edit

can we close it, then ?

berak gravatar imageberak ( 2017-12-21 08:43:25 -0600 )edit