OpenCV的imread函数读取为空的错误

问题:在Debug下可以正常的读取图片,但在Release下读图的结果总是为空。(opencv配置正确,附加依赖项正确)

解决办法:这是运行库的问题。把Release时的运行库改为/MT,Debug时的运行库改为/MTd就可以了。

参考链接:

http://www.rhyous.com/2010/09/16/avoiding-the-msvcr100-dll-or-msvcr100d-dll/


类似问题:

Release下可以正常的读取图片,在Debug下读图的结果总是为空。

原因:附加依赖项中bubug和release下的库混在一起

解决思路:

1.确定opencv是否配置正确,附加依赖项无误,

2.确定对应运行库无误,Release下/MT,Debug下/MTd


附OpenCV249的Debug和Release的附加依赖项

Debug:
opencv_calib3d249d.lib
opencv_contrib249d.lib
opencv_core249d.lib
opencv_features2d249d.lib
opencv_flann249d.lib
opencv_gpu249d.lib
opencv_highgui249d.lib
opencv_imgproc249d.lib
opencv_legacy249d.lib
opencv_ml249d.lib
opencv_nonfree249d.lib
opencv_objdetect249d.lib
opencv_ocl249d.lib
opencv_photo249d.lib
opencv_stitching249d.lib
opencv_superres249d.lib
opencv_ts249d.lib
opencv_video249d.lib
opencv_videostab249d.lib

Release:
opencv_calib3d249.lib
opencv_contrib249.lib
opencv_core249.lib
opencv_features2d249.lib
opencv_flann249.lib
opencv_gpu249.lib
opencv_highgui249.lib
opencv_imgproc249.lib
opencv_legacy249.lib
opencv_ml249.lib
opencv_nonfree249.lib
opencv_objdetect249.lib
opencv_ocl249.lib
opencv_photo249.lib
opencv_stitching249.lib
opencv_superres249.lib
opencv_ts249.lib
opencv_video249.lib
opencv_videostab249.lib


你可能感兴趣的:(调试出错,OpenCV)