Quantcast
Viewing all articles
Browse latest Browse all 12

Answer by mjepson for Hi everyone,I have been unable to find a solution for my problem, where cv::Mat image = cv::imread("path/to/file.jpg"); works in debug, but not in release build.I am using Visual C++ on Windows and OpenCV 2.4.2. My code just finds a file on disk and reads it using cv::imread. When in Debug mode, I can use cv::imshow to show the loaded image and it will. When in a release build, it won't. I have discovered that for some reason the loaded image in the release build has 1 channel, while the same image in a debug build has three.The exception is:OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in unknown function, file ......\src\opencv\modules\core\src\array.cpp, line 2482The include, and lib folders are the same for my release build as my debug build. I don't understand what's going wrong, but I would like to be able to create a release build of my program for the production environment.

Next: Comment by sammy for Hi everyone,I have been unable to find a solution for my problem, where cv::Mat image = cv::imread("path/to/file.jpg"); works in debug, but not in release build.I am using Visual C++ on Windows and OpenCV 2.4.2. My code just finds a file on disk and reads it using cv::imread. When in Debug mode, I can use cv::imshow to show the loaded image and it will. When in a release build, it won't. I have discovered that for some reason the loaded image in the release build has 1 channel, while the same image in a debug build has three.The exception is:OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in unknown function, file ......\src\opencv\modules\core\src\array.cpp, line 2482The include, and lib folders are the same for my release build as my debug build. I don't understand what's going wrong, but I would like to be able to create a release build of my program for the production environment.
Previous: Answer by Michael Burdinov for Hi everyone,I have been unable to find a solution for my problem, where cv::Mat image = cv::imread("path/to/file.jpg"); works in debug, but not in release build.I am using Visual C++ on Windows and OpenCV 2.4.2. My code just finds a file on disk and reads it using cv::imread. When in Debug mode, I can use cv::imshow to show the loaded image and it will. When in a release build, it won't. I have discovered that for some reason the loaded image in the release build has 1 channel, while the same image in a debug build has three.The exception is:OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in unknown function, file ......\src\opencv\modules\core\src\array.cpp, line 2482The include, and lib folders are the same for my release build as my debug build. I don't understand what's going wrong, but I would like to be able to create a release build of my program for the production environment.
I have finally figured it out. In my configuration under Linker, I have added Additional Library Dependencies: opencv_core242d.lib opencv_imgproc242d.lib opencv_highgui242d.lib opencv_ml242d.lib opencv_video242d.lib opencv_features2d242d.lib opencv_calib3d242d.lib opencv_objdetect242d.lib opencv_contrib242d.lib opencv_legacy242d.lib opencv_flann242d.lib It took me a while to notice that they all end with "*d.lib" and that there might be a chance that this d means "debug". Removing the d in all these files for the release build solved it! Thank you all for your help!

Viewing all articles
Browse latest Browse all 12

Trending Articles