-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
CAP_IMAGES: can't find starting number #23808
Description
System Information
General configuration for OpenCV 4.7.0-dev =====================================
Version control: 4.7.0-403-g5d913f4d72
Extra modules:
Location (extra): C:/lib/opencv_contrib/modules
Version control (extra): 4.7.0-54-g8dfeed73
Platform:
Timestamp: 2023-06-05T09:49:58Z
Host: Windows 10.0.22621 AMD64
CMake: 3.26.1
CMake generator: Visual Studio 17 2022
CMake build tool: C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe
MSVC: 1935
Configuration: Debug Release
CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
SSE4_1 (18 files): + SSSE3 SSE4_1
SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (36 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
AVX512_SKX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
C/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe (ver 19.35.32215.0)
C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /MD /O2 /Ob2 /DNDEBUG
C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /MDd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe
C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /MP /MD /O2 /Ob2 /DNDEBUG
C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /MP /MDd /Zi /Ob0 /Od /RTC1
Linker flags (Release): /machine:x64 /INCREMENTAL:NO
Linker flags (Debug): /machine:x64 /debug /INCREMENTAL
ccache: NO
Precompiled headers: YES
Extra dependencies: cudart_static.lib nppc.lib nppial.lib nppicc.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cudnn.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/lib/x64
3rdparty dependencies:
OpenCV modules:
To be built: alphamat aruco barcode bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform java line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
Disabled: world
Disabled by dependency: -
Unavailable: cvv freetype hdf julia matlab ovis python2
Applications: tests perf_tests examples apps
Documentation: doxygen python javadoc
Non-free algorithms: YES
Windows RT support: NO
GUI: WIN32UI
Win32 UI: YES
OpenGL support: YES (opengl32 glu32)
VTK support: YES (ver 9.2.5)
Media I/O:
ZLib: optimized C:/install/zlib/lib/zlib.lib debug C:/install/zlib/lib/zlibd.lib (ver 1.2.13)
JPEG: build-libjpeg-turbo (ver 2.1.3-62)
SIMD Support Request: YES
SIMD Support: NO
WEBP: build (ver encoder: 0x020f)
PNG: optimized C:/install/libpng/lib/libpng16.lib debug C:/install/libpng/lib/libpng16d.lib (ver 1.6.40)
TIFF: build (ver 42 - 4.2.0)
JPEG 2000: build (ver 2.5.0)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
DC1394: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (58.134.100)
avformat: YES (58.76.100)
avutil: YES (56.70.100)
swscale: YES (5.9.100)
avresample: YES (4.0.0)
GStreamer: NO
DirectShow: YES
Media Foundation: YES
DXVA: YES
Parallel framework: Concurrency
Other third-party libraries:
Intel IPP: 2021.8 [2021.8.0]
at: C:/lib/build/opencv/3rdparty/ippicv/ippicv_win/icv
Intel IPP IW: sources (2021.8.0)
at: C:/lib/build/opencv/3rdparty/ippicv/ippicv_win/iw
Lapack: YES (C:/Program Files (x86)/Intel/oneAPI/mkl/2023.0.0/lib/intel64/mkl_intel_lp64.lib C:/Program Files (x86)/Intel/oneAPI/mkl/2023.0.0/lib/intel64/mkl_sequential.lib C:/Program Files (x86)/Intel/oneAPI/mkl/2023.0.0/lib/intel64/mkl_core.lib)
OpenVINO: YES (2022.3.0)
Eigen: YES (ver ..)
Custom HAL: NO
Protobuf: build (3.19.1)
Flatbuffers: builtin/3rdparty (23.5.9)
NVIDIA CUDA: YES (ver 12.1, CUFFT CUBLAS)
NVIDIA GPU arch: 86
NVIDIA PTX archs:
cuDNN: YES (ver 8.8.0)
OpenCL: YES (NVD3D11)
Include path: C:/lib/opencv/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python 3:
Interpreter: C:/Program Files/Python310/python.exe (ver 3.10.10)
Libraries: optimized C:/Program Files/Python310/libs/python310.lib debug C:/Program Files/Python310/libs/python310_d.lib (ver 3.10.10)
numpy: C:/Users/laurent/AppData/Roaming/Python/Python310/site-packages/numpy/core/include (ver 1.23.5)
install path: C:/Users/laurent/AppData/Roaming/Python/Python310/site-packages/cv2/python-3.10
Python (for build): C:/Program Files/Python310/python.exe
Java:
ant: C:/apache-ant-1.10.13/bin/ant.bat (ver 1.10.13)
JNI: C:/Program Files/Java/jdk-19/include C:/Program Files/Java/jdk-19/include/win32 C:/Program Files/Java/jdk-19/include
Java wrappers: YES
Java tests: YES
Install to: C:/install/opencv
Detailed description
this code gives no error :
import cv2 as cv
img_read = cv.imread(cv.samples.findFile("lena.jpg"))
vid = cv.VideoCapture(cv.samples.findFile("lena.jpg"))
ret, img_vid = vid.read()
print("video open : ", img_vid[0, 0, :])
print("imread : ", img_read[0, 0, :])
and results are not equal because ffmpeg uses its own jpeg decoder
video open : [127 137 224]
imread : [128 138 225]
So I want to use imread I add apipreference CAP_IMAGES
import cv2 as cv
vid = cv.VideoCapture(cv.samples.findFile("lena.jpg"), cv.CAP_IMAGES)
and there is an exception :
Exception
[ WARN:0@0.088] global samples.cpp:61 cv::samples::findFile cv::samples::findFile('lena.jpg') => 'C:\lib\opencv\samples/data\lena.jpg'
[ERROR:0@0.088] global cap.cpp:166 cv::VideoCapture::open VIDEOIO(CV_IMAGES): raised OpenCV exception:
OpenCV(4.7.0-dev) C:\lib\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): C:\lib\opencv\samples/data\lena.jpg in function 'cv::icvExtractPattern'
[ WARN:0@0.088] global cap.cpp:206 cv::VideoCapture::open VIDEOIO(CV_IMAGES): backend is generally available but can't be used to capture by name
Many example in DNN module uses VideoCapture.Open to read a file
Inference with VideoCapture.Open and imread do not give same results.
Steps to reproduce
Same problem in C++
All codes is already given
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)