Matplotlib to replace imshow()

asked 2017-08-02 06:48:29 -0600

Raki gravatar image

updated 2017-08-03 04:32:14 -0600

I have installed OpenCV 3.x with Python 3 and I am running these on Ubuntu 16.04, however since the video related functionality is not implemented and thus giving the error of "This function is not implemented", I am looking for an alternative to imshow(). I know that I can display a picture with Matplotlib, can we do the same with videos? If so, how?

EDIT: So this is the command I used to build my OpenCV from source:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=OFF -D WITH_GTK=ON -D WITH_OPENGL=ON -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules  ..

Note that I have WITH_GTK=ON .

And this is the long output I have:

-- Detected version of GNU GCC: 54 (504)
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
-- Checking for module 'gstreamer-base-1.0'
--   No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-video-1.0'
--   No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
--   No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
--   No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
--   No package 'gstreamer-pbutils-1.0' found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavresample'
--   No package 'libavresample' found
-- Checking for module 'libgphoto2'
--   No package 'libgphoto2' found
-- Found TBB: /usr/lib/x86_64-linux-gnu/libtbb.so
-- found Intel IPP (ICV version): 2017.0.2 [2017.0.2]
-- at: /home/name/opencv/build/3rdparty/ippicv/ippicv_lnx
-- found Intel IPP IW binaries: 2017.0.2
-- at: /home/name/opencv/build/3rdparty/ippicv/ippicv_lnx/../ippiw_lnx/
-- CUDA detected: 8.0
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-D_FORCE_INLINES
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing:  Atlas_CLAPACK_INCLUDE_DIR) 
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) 
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
-- Caffe:   NO
-- Protobuf:   YES
-- Glog:   NO
-- Looking for tiny_dnn.h
-- Looking for tiny_dnn.h - found
-- Found tiny-dnn in: /home/name/opencv/build/3rdparty/tinydnn/tiny-dnn-1.0.0a3
-- The protocol buffer compiler is not found (PROTOBUF_PROTOC_EXECUTABLE='PROTOBUF_PROTOC_EXECUTABLE-NOTFOUND')
-- freetype2:   YES
-- harfbuzz:    YES
-- Could NOT find HDF5 (missing:  HDF5_LIBRARIES HDF5_INCLUDE_DIRS) 
-- No prefnamece for use of exported gflags CMake configuration set, and no hints for include ...
(more)
edit retag flag offensive close merge delete

Comments

"I have installed OpenCV 3.x with Python 3" -- how so ?

(if your package manager does not deliver, try to build from src)

berak gravatar imageberak ( 2017-08-03 02:43:11 -0600 )edit

I followed the very same guide for OpenCV, and I am getting that This function is not implemented error. Hence the question for Matplotlib.

Raki gravatar imageRaki ( 2017-08-03 03:59:01 -0600 )edit
1

this means, that dependancies, like v4l or gtk could not be found when building the opencv libs.

try again, when in doubt, add the cmake output to your question (it's long !) , so we can see, what went wrong

berak gravatar imageberak ( 2017-08-03 04:07:43 -0600 )edit
1

looking at the cmake output, you should have both gui and video functionality.

did you forget to run make install ? (or any other reason, you're not using your newly build cv2.so ?)

cross check with cv2.getBuildInformation()

berak gravatar imageberak ( 2017-08-03 04:38:30 -0600 )edit

That seems to be the case because the output says GTK+ support is set to NO, which should not be the case. How can I use the newly built one?

Raki gravatar imageRaki ( 2017-08-03 05:42:07 -0600 )edit

again, try with make install,

or manually copy your cv2.so to lib/site-packages

or use a virtual env

berak gravatar imageberak ( 2017-08-03 05:45:37 -0600 )edit

make install is not the issue, I ran that already. As for cv2.so, it exists under two locations, which are /home/name/opencv/build/lib/cv2.so , /usr/local/lib/python2.7/dist-packages/cv2.so. So, where is the newly built one and to which of these paths I should copy it to? (Or to both?)

Raki gravatar imageRaki ( 2017-08-03 05:56:42 -0600 )edit

no idea atm., sorry.

berak gravatar imageberak ( 2017-08-03 06:04:31 -0600 )edit