, LEAP 15.x python3-opencv making intellisense prompting work

Here is the issue. If package python3-opencv is installed from the opensuse repo source, a python developer does not get intellisense prompting inside an IDE such as Microsoft’s code. If the user installs opencv-python using pip from the usual sources of pre-built wheels, intellisense prompting works but gstreamer camera apps, and possibly other apps do not work. I believe that the issue is that the usual wheel builds do not include gstreamer support.

I was able to fix the issue by manually building opencv-python and installing it as a user python package. Here is an overview of the build.

all of the usual packages for C/C++ development are installed as root, plus you need a lot of code development packages including
git
cmake
python3-devel
gstreamer-devel

I’ll list more packages at the end of this post to have various features added to the opencv that gets built. The python package does not attempt to link with an installed opencv. Build steps:

do package installs as root, see list at end

build and install may be done as ordinary user

You can review the features that are built into your system install of opencv:

opencv_version -v

if user has updated pip, get the new pip on the user PATH

export PATH=~/.local/bin:$PATH
cd
git clone --recursive https://github.com/opencv/opencv-python.git
cd opencv-python
export ENABLE_HEADLESS=0 # 1 or 0 your choice
export ENABLE_CONTRIB=1 # 1 or 0 your choice, 1 makes for a bigger .so
export CMAKE_ARGS="-DWITH_GSTREAMER=ON -DWITH_QT=ON -DWITH_OPENGL=ON"
pip wheel . --verbose 2>&1 | tee build.log

after about a half hour, the build is done. Review build.log to see what was built, and then

pip install opencv_contrib_python-4.6.0+fcc900e-cp36-cp36m-linux_x86_64.whl

save build.log, it tells you the configuration of what was built

For the packages, I have the packman repos enabled for system libraries etc, and I think this may be necessary for H.264 codec support. Try to install the following packages as root before the build depending on the features you want. There are some name variations for various 15.x distros.

gstreamer-utils
gstreamer-devtools ? not 15.1
opencv-devel
libautil-devel ? not 15.1
libpng16-devel
libturbojpeg0 and/or libjpeg-turbo
libswscale-devel ? (on 15.1 is ffmpeg-3-libswscale-devel)
libtiff-devel
libavcodec-devel ? (15.1 ffmpeg-3-libavcodec-devel)
libavformat-devel ? (15.1 ffmpeg-3-…)
libv4l-devel
libQt5Core-devel
openjpeg-devel openjpeg2-devel
ilmbase-devel
openexr-devel
libwebb-devel ? (missing on 15.1)
libzstd-devel
libxz-devel
gstreamer-plugins-base-devel
gstreamer-devtools-devel ? (missing on 15.1)
openjpeg openjpeg2
eigen3-devel
harfbuzz-devel
blas-devel
openblas-devel
lapack-devel
gtk3-devel (pulls in many deps)
ffmpeg-3-libavutil-devel
ffmpeg-3-libavcodec-devel
gstreamer-plugins-ugly
gstreamer-plugins-ugly-codecs ? (not on 15.1)
gstreamer-plugins-bad
gstreamer-plugins-bad-codecs ? (not on 15.1)
libavc1394-devel

Regards,
Ed Hume