Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked Mar 13 '13

berak gravatar image

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

click to hide/show revision 2
No.2 Revision

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.3 suspecting strange string settings, unicode woes, python compiled against a different runtime, hell, that's the stuff i hate most ;(

click to hide/show revision 3
No.3 Revision

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.3 python2.7.1 suspecting strange string settings, unicode woes, python compiled against a different runtime, hell, that's the stuff i hate most ;(

click to hide/show revision 4
No.4 Revision

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 )