使用opencv4.7.0的VideoCapture时遇到问题
[ERROR:0@0.286] global cap.cpp:166 cv::VideoCapture::open VIDEOIO(CV_IMAGES): raised OpenCV exception:
OpenCV(4.7.0) D:\gitlabrunner\builds\9mBtm_2r\0\3rdparty\opencv-build\opencv\modules\videoio\src\cap_images.cpp:267: error: (-215:Assertion failed) number < max_number in function 'cv::icvExtractPattern'
运行debug模式打印信息
[ INFO:0@0.060] global videoio_registry.cpp:232 cv::`anonymous-namespace'::VideoBackendRegistry::VideoBackendRegistry VIDEOIO: Enabled backends(9, sorted by priority): FFMPEG(1000); GSTREAMER(990); INTEL_MFX(980); MSMF(970); DSHOW(960); CV_IMAGES(950); CV_MJPEG(940); UEYE(930); OBSENSOR(920)
[ INFO:0@0.061] global backend_plugin.cpp:383 cv::impl::getPluginCandidates Found 3 plugin(s) for FFMPEG
[ INFO:0@0.061] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load G:\project\featurebooster_cpp\build\Debug\opencv_videoio_ffmpeg470_64d.dll => FAILED
[ INFO:0@0.062] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_videoio_ffmpeg470_64d.dll => FAILED
[ INFO:0@0.062] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_videoio_ffmpeg470_64.dll => FAILED
[ INFO:0@0.063] global backend_plugin.cpp:383 cv::impl::getPluginCandidates Found 2 plugin(s) for GSTREAMER
[ INFO:0@0.063] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load G:\project\featurebooster_cpp\build\Debug\opencv_videoio_gstreamer470_64d.dll => FAILED
[ INFO:0@0.063] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_videoio_gstreamer470_64d.dll => FAILED
[ INFO:0@0.063] global backend_plugin.cpp:383 cv::impl::getPluginCandidates Found 2 plugin(s) for INTEL_MFX
[ INFO:0@0.063] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load G:\project\featurebooster_cpp\build\Debug\opencv_videoio_intel_mfx470_64d.dll => FAILED
[ INFO:0@0.064] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_videoio_intel_mfx470_64d.dll => FAILED
[ INFO:0@0.128] global cap_msmf.cpp:1027 CvCapture_MSMF::configureHW MSMF: Using D3D11 video acceleration on GPU device: Intel(R) UHD Graphics 770
OpenCV(4.7.0) Error: Assertion failed (number < max_number) in cv::icvExtractPattern, file D:\gitlabrunner\builds\9mBtm_2r\0\3rdparty\opencv-build\opencv\modules\videoio\src\cap_images.cpp, line 267
[ERROR:0@0.353] global cap.cpp:166 cv::VideoCapture::open VIDEOIO(CV_IMAGES): raised OpenCV exception:OpenCV(4.7.0) D:\gitlabrunner\builds\9mBtm_2r\0\3rdparty\opencv-build\opencv\modules\videoio\src\cap_images.cpp:267: error: (-215:Assertion failed) number < max_number in function 'cv::icvExtractPattern'
错误信息红色加粗,发现是运行时load视频编解码用的ddl失败。尝试把需要的opencv_videoio_ffmpeg470_64d.dll放到build/debug文件夹(可执行.exe同路径)下即可。ddl可在opencv库中的bin文件夹找到,如果没有opencv_videoio_ffmpeg470_64d.dll,可使用opencv_videoio_ffmpeg470_64.dll。
具体步骤:
把opencv_videoio_ffmpeg470_64.dll拷贝到需要运行的exe的同文件。
文章来源:https://www.toymoban.com/news/detail-771279.html
VideoWriter等其他视频编解码接口遇到相同问题解决方法相同。文章来源地址https://www.toymoban.com/news/detail-771279.html
到了这里,关于OpenCV error: (-215:Assertion failed) number < max_number in function ‘cv::icvExtractPattern‘ 解决方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!