Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

error: (-215:Assertion failed) !_img.empty() in function 'imwrite

I'm facing this issue when using opencv libraries

> terminate called after throwing an
> instance of 'cv::Exception' what():
> OpenCV(4.1.2)
> /home/candrew/opencv-test/opencv/modules/imgcodecs/src/loadsave.cpp:715:
> error: (-215:Assertion failed)
> !_img.empty() in function 'imwrite

Can i know what is it that i'm missing? could it be my below configuration is missing some build parameters?

System information (version)
OpenCV => 4.1.2
Operating System / Platform => Clear Linux OS
Compiler => 9.2.1

Steps to reproduce

Compiled opencv on my machine with below configuration:

-- General configuration for OpenCV 4.1.2 =====================================
-- Version control: 4.1.2
-- Platform:
-- Timestamp: 2019-12-16T09:20:16Z
-- Host: Linux 5.3.5-847.native x86_64
-- CMake: 3.15.4
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/gmake
-- Configuration: ReleaseWithDebInfo
-- CPU/HW features:
-- Baseline: SSE SSE2 SSE3 SSSE3 SSE4_1 POPCNT SSE4_2
-- requested: SSE3
-- required: SSE4_2
-- Dispatched code generation: AVX AVX2 AVX512_SKX
-- AVX (5 files): + AVX
-- AVX2 (30 files): + FP16 FMA3 AVX AVX2
-- AVX512_SKX (6 files): + FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/lib64/ccache/bin/g++ (ver 9.2.1)
-- C++ flags (Release): -g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -fno-semantic-interposition -ffat-lto-objects -fno-trapping-math -Wl,-sort-common -Wl,--enable-new-dtags -mtune=skylake -fvisibility-inlines-hidden -Wl,--enable-new-dtags -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -fopenmp -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -fno-semantic-interposition -ffat-lto-objects -fno-trapping-math -Wl,-sort-common -Wl,--enable-new-dtags -mtune=skylake -fvisibility-inlines-hidden -Wl,--enable-new-dtags -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -fopenmp -g -DDEBUG -D_DEBUG
-- C Compiler: /usr/lib64/ccache/bin/gcc
-- C flags (Release): -g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -fno-semantic-interposition -ffat-lto-objects -fno-trapping-math -Wl,-sort-common -Wl,--enable-new-dtags -mtune=skylake -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -fopenmp -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -fno-semantic-interposition -ffat-lto-objects -fno-trapping-math -Wl,-sort-common -Wl,--enable-new-dtags -mtune=skylake -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -fopenmp -g -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--gc-sections
-- Linker flags (Debug): -Wl,--gc-sections
-- ccache: YES
-- Precompiled headers: NO
-- Extra dependencies: dl m pthread rt
-- 3rdparty dependencies:
-- OpenCV modules:
-- To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching ts video videoio
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: java js python2
-- Applications: tests perf_tests examples apps
-- Documentation: NO
-- Non-free algorithms: NO
-- GUI:
-- GTK+: YES (ver 3.24.12)
-- GThread : YES (ver 2.62.1)
-- GtkGlExt: NO
-- VTK support: NO
-- Media I/O:
-- ZLib: /lib64/ (ver
-- JPEG: /lib64/ (ver 62)
-- WEBP: /lib64/ (ver encoder: 0x020e)
-- PNG: /lib64/ (ver 1.6.37)
-- Video I/O:
-- avcodec: YES (58.35.100)
-- avformat: YES (58.20.100)
-- avutil: YES (56.22.100)
-- swscale: YES (5.3.100)
-- avresample: NO
-- GStreamer: YES (1.16.0)
-- v4l/v4l2: YES (linux/videodev2.h)
-- Parallel framework: TBB (ver 2019.0 interface 11001)
-- Trace: YES (with Intel ITT)
-- Other third-party libraries:
-- VA: YES
-- Lapack: YES (/lib64/
-- Inference Engine: NO
-- Eigen: YES (ver 3.3.7)
-- Custom HAL: NO
-- Protobuf: build (3.5.1)
-- Vulkan: YES
-- Include path: /home/candrew/opencv-test/opencv/3rdparty/include
-- Link libraries: Dynamic load
-- OpenCL: YES (no extra features)
-- Include path: /home/candrew/opencv-test/opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
-- Python 3:
-- Interpreter: /usr/bin/python3 (ver 3.7.4)
-- Libraries: /lib64/ (ver 3.7.4)
-- numpy: /usr/lib/python3.7/site-packages/numpy/core/include (ver 1.17.2)
-- install path: /usr/lib/python3.8/site-packages//cv2/python-3.7
-- Python (for build): /usr/bin/python2.7
-- Flake8: /usr/bin/flake8 (ver: 3.7.8)
-- Java:
-- ant: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
-- Install to: /usr/local