can't imread or imwrite in python
my first go at the python api (on win, 2.4.9), built cv2.pyd, but i can't imread ( result always None) or imwrite ( "could not find a writer for the specified extension" )
checked the pyd with dependancy walker, it's using the same dlls as my c++ code does (no problem there, png, jpg support built in ) other stuff in python seems to work well, e.g opening a videocapture / imshow
Edit: oh, fun, it turns out all strings i pass into the opencv api come out empty.
indeed, imwrite can't find a writer for 'empty string', but why doesn't it tell me ?
and why does it happen in the first place ?
using VS2008 here, python2.7.1 suspecting strange string settings, unicode woes, python compiled against a different runtime, hell, that's the stuff i hate most ;(
Edit: Problem solved ( finally ...)
had to choose /D "UNICODE" ( unicode support in the general settings )
most of the std::strings in opencv have been replaced with cv::Strings, i guess they only work with unicode ( when combined with python )
Could it be a problem with relative and absolute paths?
thanks for the hint, but i think - no.
cv2.error: ..\..\..\modules\highgui\src\loadsave.cpp:269: error: (-2) could not find a writer for the specified extension
does not look like a path problem, right ?
error is even coming from the opencv library, and that's the same i'm using from c++
could you post the exact imwrite command you are using? to me this error means that you are trying to write a specific type of image compression or so that is not recognized by the python implementation.
Just to illustrate my opinion: using imwrite("d:\test.jpg",image) in C++ defines which type of imageconversion it needs to use based on the .jpg extension in the file name. So knowing what extension you using, could locate the problem.
http://bpaste.net/show/ntKuIAMs9Tdx3YCHAzh7/
(posting code in comments here is a PITA)
thanks for breaking your head, btw ;)