Git Product home page Git Product logo

cvvidproc's Introduction

README

Version: 1.0.0

Dependencies:

  • CMake
  • compiler with c++14 support
  • Python3
  • scikit-build (pip3 install scikit-build)
  • OpenCV (>= 4.2.0)
  • NumPy (pip3 install numpy)
  • pybind11 (pip3 install pybind11)

Table Of Contents

About

cvvidproc is a small library with utilities for processing OpenCV videos. It was developed to support Andy Ylitalo's bubble-tracking project with faster implementations of video processing than can be achieved in pure Python. See API.md for the Python API.

Install Python module cvvidproc

As simple as:

pip3 install .

For manually installed OpenCV, you must define these environment variables:

CV_DIR=path/to/location/of/opencv/library   // e.g. ~/MyLibs/
CV_INSTALL_DIR=path/to/opencv/installation  // e.g. ~/MyLibs/OpenCV/opencv-1.2.3/release/

# full call for installing python module
CV_DIR=~/MyLibs/ \
    CV_INSTALL_DIR=~/MyLibs/OpenCV/opencv-1.2.3/release/ \
    pip3 install .
  • Rerunning this command after files are changed will update the installation. E.g. git pull origin master -> git merge origin/master -> pip3 install .. Use git remote add upstream 'upstream repo url' to connect local repo with upstream/origin (upstream is developer repo, origin is remote clone e.g. in Github).

Building and Running as Standalone Demo Program

Generate the build system:

// in command line
cmake -S . -B Build

// the OpenCV directory flags must have -D in this case
-DCV_DIR=~/MyLibs/
-DCV_INSTALL_DIR=~/MyLibs/OpenCV/opencv-1.2.3/release/

// for example
cmake -S . -B Build -DCV_DIR=~/MyLibs/ -DCV_INSTALL_DIR=~/MyLibs/OpenCV/opencv-1.2.3/release/

Build the project:

cmake --build Build

Execute program:

./Build/cvvidproc --vid=vid.mp4

Notes:

  • place videos in Videos/ directory to make them easily findable by program, or pass the entire video path to --vid_path=path/to/vid/your_vid.vid_ext
  • use tag --help to learn command line options

Installing OpenCV on Ubuntu

If you have Linux, here are all the recommended packages to install first, and steps to take.

  • start by updating your existing packages
sudo apt-get update
sudo apt-get upgrade
  • for video I/O
sudo apt-get install build-essential cmake unzip pkg-config
sudo apt-get install libjpeg-dev libpng-dev libtiff-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
  • for GTK as GUI backend
sudo apt-get install libgtk-3-dev
  • for mathematical optimizations
sudo apt-get install libatlas-base-dev gfortran 
  • FFMPEG and supporting packages for video support
sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev libswscale-dev
  • gstreamer for opening and viewing mp4 files (not required for opencv, but nice to have if dealing with mp4s)
sudo apt install gstreamer1.0-libav
  • packages for gstreamer to be found by cmake during OpenCV build
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
wget -O opencv.zip https://github.com/opencv/opencv/archive/master.zip
unzip opencv.zip
mv opencv-master opencv
mkdir -p build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/ -D INSTALL_C_EXAMPLES=OFF -D BUILD_TEST=OFF -D WITH_FFMPEG=ON -D WITH_OPENCL=OFF -D BUILD_PERF_TESTS=OFF -D WITH_GTK=ON -D WITH_GSTREAMER=ON ..
  • assuming you are in directory opencv/build, first build then install OpenCV (note: installing is optional, see the tutorial's warning on that subject)
make -j4
sudo make install

If you decline to install with sudo make install, then you must manually link OpenCV to cvvidproc. If, for example, you build OpenCV in the directory "~", then the command for generating a build system will be:

cmake -S . -B Build -D CV_DIR=/~/ -D CV_INSTALL_DIR=/~/opencv/build/

Ubuntu users may need to download and set up an 'X server for Windows' by following this tutorial. If your Ubuntu doesn't already have it, install GTK3 for backend GUI with:

sudo apt-get install libgtk-3-0

License

MIT license

cvvidproc's People

Contributors

andylitalo avatar ukoehb avatar

Stargazers

 avatar

Watchers

 avatar  avatar

cvvidproc's Issues

import cvvidproc requires import cv2

Not a big issue, but just wanted to record that, if I don't import cv2 before cvvidproc, I get the following error:

Traceback (most recent call last):
File "test_tracking.py", line 16, in
import cvvidproc
File "/home/aylitalo/.local/lib/python3.8/site-packages/cvvidproc/init.py", line 4, in
from ._core import doc, VidBgPack, GetVideoBackground, HighlightBubblesPack, AssignBubblesPack, VidBubbleTrackPack, TrackBubbles
ImportError: libopencv_videoio.so.4.5: cannot open shared object file: No such file or directory

If I import cv2 beforehand, it works fine.

cvvidproc.GetVideoBackground Crashes

When computing the background with the following method in python

def compute_bkgd_med(vid_path, num_frames=100):
vidpack = cvvidproc.VidBgPack(
vid_path,
'hist',
-1,
num_frames,
True,
0,
0,
200,
200)

print('getting video background')
bkgd_med = cvvidproc.GetVideoBackground(vidpack)
print('video background obtained')

return bkgd_med

I get the following output:

getting video background
Frames: 2056; Res: 1280x512(200x512 cropped); FPS: 60
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.5.1-dev) /home/aylitalo/opencv/modules/core/src/matrix.cpp:810: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'

Aborted (core dumped)

"Error: use of deleted function:

In step 4 of 9 of the build during installation (building cv_vid_bg_helpers.cpp.o), the following error arose

In file included from ../../../Sources/AsyncTokens/token_batch_generator.h:7,
from ../../../Sources/AsyncTokens/async_token_batch_generator.h:7,
from ../../../Sources/cv_vid_bg_helpers.cpp:4:
../../../Sources/AsyncTokens/ts_interval_timer.h:109:46: error: use of deleted function ‘std::atomic<_Tp>::atomic() [with _Tp = TSIntervalTimer::IntervalPair]’
109 | std::atomic m_interval_record{};
| ^
In file included from ../../../Sources/AsyncTokens/ts_interval_timer.h:11,
from ../../../Sources/AsyncTokens/token_batch_generator.h:7,
from ../../../Sources/AsyncTokens/async_token_batch_generator.h:7,
from ../../../Sources/cv_vid_bg_helpers.cpp:4:
/usr/include/c++/9/atomic:198:7: note: ‘std::atomic<_Tp>::atomic() noexcept [with _Tp = TSIntervalTimer::IntervalPair]’ is implicitly deleted because its exception-specification does not match the implicit exception-specification ‘’
198 | atomic() noexcept = default;
| ^~~~~~

I'm not sure of the cause, but I found this stackoverflow post describing a possible cause in detail.

A similar error occurs in step 5 of 9 (building main.cpp.o):

In file included from ../../../Sources/main.cpp:9:
../../../Sources/AsyncTokens/ts_interval_timer.h:109:46: error: use of deleted function ‘std::atomic<_Tp>::atomic() [with _Tp = TSIntervalTimer::IntervalPair]’
109 | std::atomic m_interval_record{};
| ^
In file included from ../../../Sources/AsyncTokens/ts_interval_timer.h:11,
from ../../../Sources/main.cpp:9:
/usr/include/c++/9/atomic:198:7: note: ‘std::atomic<_Tp>::atomic() noexcept [with _Tp = TSIntervalTimer::IntervalPair]’ is implicitly deleted because its exception-specification does not match the implicit exception-specification ‘’
198 | atomic() noexcept = default;
| ^~~~~~

and in step 7 of 9 (building cv_vid_bubbletrack_helpers.cpp.o):

In file included from ../../../Sources/AsyncTokens/token_batch_generator.h:7,
from ../../../Sources/AsyncTokens/async_token_batch_generator.h:7,
from ../../../Sources/cv_vid_bubbletrack_helpers.cpp:5:
../../../Sources/AsyncTokens/ts_interval_timer.h:109:46: error: use of deleted function ‘std::atomic<_Tp>::atomic() [with _Tp = TSIntervalTimer::IntervalPair]’
109 | std::atomic m_interval_record{};
| ^
In file included from ../../../Sources/AsyncTokens/ts_interval_timer.h:11,
from ../../../Sources/AsyncTokens/token_batch_generator.h:7,
from ../../../Sources/AsyncTokens/async_token_batch_generator.h:7,
from ../../../Sources/cv_vid_bubbletrack_helpers.cpp:5:
/usr/include/c++/9/atomic:198:7: note: ‘std::atomic<_Tp>::atomic() noexcept [with _Tp = TSIntervalTimer::IntervalPair]’ is implicitly deleted because its exception-specification does not match the implicit exception-specification ‘’
198 | atomic() noexcept = default;
| ^~~~~~

Install failed in python virtual environment

I created a virtual environment with Python 3.8 containing only numpy, scikit-build, and pybind11, with the hard-coded reference to my OpenCV installation, and received a similar error message as when I installed in my standard environment. The last few lines seem most relevant (I've addressed the errors during the build in other issues). It says to check the CMake output, but I can't figure out where that is:

running clean
Processing /mnt/c/Users/andyl/OneDrive - California Institute of Technology/Documents/Research/Kornfield/ANALYSIS/bubble-tracking/CvVidProc
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Building wheels for collected packages: cvvidproc
Building wheel for cvvidproc (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /mnt/c/Users/andyl/envs/cvkoe/bin/python /mnt/c/Users/andyl/envs/cvkoe/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpqwpy_tin
cwd: /tmp/pip-req-build-0iv3byhy
Complete output (135 lines):
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 9.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is GNU 9.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-req-build-0iv3byhy/_cmake_test_compile/build
CMAKE version used: 3.18.4
-- The CXX compiler identification is GNU 9.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /mnt/c/Downloads/opencv/build (found version "4.5.1")
-- Found Python3: /mnt/c/Users/andyl/envs/cvkoe/bin/python (found version "3.8.5") found components: Interpreter Development NumPy Development.Module Development.Embed
'/mnt/c/Users/andyl/envs/cvkoe/bin/python' '-c' 'import pybind11; print(pybind11.get_cmake_dir())'
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Found pybind11: /tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/pybind11/include (found version "2.6.2" )
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-req-build-0iv3byhy/_skbuild/linux-x86_64-3.8/cmake-build
[1/9] Building CXX object CMakeFiles/_core.dir/Sources/py_bindings.cpp.o
FAILED: CMakeFiles/_core.dir/Sources/py_bindings.cpp.o
/usr/bin/c++ -D_core_EXPORTS -Igenerated -I../../../Sources/AsyncTokens -I../../../Sources/ProcessorAlgos -I../../../Sources/ProcessorTokenHandlers -I../../../Sources/Utility -isystem /mnt/c/Downloads/opencv/build -isystem /mnt/c/Downloads/opencv/include -isystem /mnt/c/Downloads/opencv/modules/core/include -isystem /mnt/c/Downloads/opencv/modules/flann/include -isystem /mnt/c/Downloads/opencv/modules/imgproc/include -isystem /mnt/c/Downloads/opencv/modules/ml/include -isystem /mnt/c/Downloads/opencv/modules/photo/include -isystem /mnt/c/Downloads/opencv/modules/dnn/include -isystem /mnt/c/Downloads/opencv/modules/features2d/include -isystem /mnt/c/Downloads/opencv/modules/imgcodecs/include -isystem /mnt/c/Downloads/opencv/modules/videoio/include -isystem /mnt/c/Downloads/opencv/modules/calib3d/include -isystem /mnt/c/Downloads/opencv/modules/highgui/include -isystem /mnt/c/Downloads/opencv/modules/objdetect/include -isystem /mnt/c/Downloads/opencv/modules/stitching/include -isystem /mnt/c/Downloads/opencv/modules/ts/include -isystem /mnt/c/Downloads/opencv/modules/video/include -isystem /mnt/c/Downloads/opencv/modules/gapi/include -isystem /usr/include/python3.8 -isystem /tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/pybind11/include -isystem /tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/numpy/core/include -O3 -DNDEBUG -fPIC -fvisibility=hidden -flto -fno-fat-lto-objects -pthread -std=gnu++14 -MD -MT CMakeFiles/_core.dir/Sources/py_bindings.cpp.o -MF CMakeFiles/_core.dir/Sources/py_bindings.cpp.o.d -o CMakeFiles/_core.dir/Sources/py_bindings.cpp.o -c ../../../Sources/py_bindings.cpp
../../../Sources/py_bindings.cpp:9:10: fatal error: token_processor_algo_base.h: No such file or directory
9 | #include "token_processor_algo_base.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[2/9] Building CXX object CMakeFiles/_core.dir/Sources/Utility/ndarray_converter.cpp.o
[3/9] Building CXX object CMakeFiles/_core.dir/Sources/ProcessorAlgos/highlight_bubbles_algo.cpp.o
[4/9] Building CXX object CMakeFiles/_core.dir/Sources/Utility/cv_util.cpp.o
[5/9] Building CXX object CMakeFiles/_core.dir/Sources/cv_vid_bg_helpers.cpp.o
FAILED: CMakeFiles/_core.dir/Sources/cv_vid_bg_helpers.cpp.o
/usr/bin/c++ -D_core_EXPORTS -Igenerated -I../../../Sources/AsyncTokens -I../../../Sources/ProcessorAlgos -I../../../Sources/ProcessorTokenHandlers -I../../../Sources/Utility -isystem /mnt/c/Downloads/opencv/build -isystem /mnt/c/Downloads/opencv/include -isystem /mnt/c/Downloads/opencv/modules/core/include -isystem /mnt/c/Downloads/opencv/modules/flann/include -isystem /mnt/c/Downloads/opencv/modules/imgproc/include -isystem /mnt/c/Downloads/opencv/modules/ml/include -isystem /mnt/c/Downloads/opencv/modules/photo/include -isystem /mnt/c/Downloads/opencv/modules/dnn/include -isystem /mnt/c/Downloads/opencv/modules/features2d/include -isystem /mnt/c/Downloads/opencv/modules/imgcodecs/include -isystem /mnt/c/Downloads/opencv/modules/videoio/include -isystem /mnt/c/Downloads/opencv/modules/calib3d/include -isystem /mnt/c/Downloads/opencv/modules/highgui/include -isystem /mnt/c/Downloads/opencv/modules/objdetect/include -isystem /mnt/c/Downloads/opencv/modules/stitching/include -isystem /mnt/c/Downloads/opencv/modules/ts/include -isystem /mnt/c/Downloads/opencv/modules/video/include -isystem /mnt/c/Downloads/opencv/modules/gapi/include -isystem /usr/include/python3.8 -isystem /tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/pybind11/include -isystem /tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/numpy/core/include -O3 -DNDEBUG -fPIC -fvisibility=hidden -flto -fno-fat-lto-objects -pthread -std=gnu++14 -MD -MT CMakeFiles/_core.dir/Sources/cv_vid_bg_helpers.cpp.o -MF CMakeFiles/_core.dir/Sources/cv_vid_bg_helpers.cpp.o.d -o CMakeFiles/_core.dir/Sources/cv_vid_bg_helpers.cpp.o -c ../../../Sources/cv_vid_bg_helpers.cpp
In file included from ../../../Sources/AsyncTokens/token_batch_generator.h:7,
from ../../../Sources/AsyncTokens/async_token_batch_generator.h:7,
from ../../../Sources/cv_vid_bg_helpers.cpp:4:
../../../Sources/AsyncTokens/ts_interval_timer.h:109:46: error: use of deleted function ‘std::atomic<_Tp>::atomic() [with _Tp = TSIntervalTimer::IntervalPair]’
109 | std::atomic m_interval_record{};
| ^
In file included from ../../../Sources/AsyncTokens/ts_interval_timer.h:11,
from ../../../Sources/AsyncTokens/token_batch_generator.h:7,
from ../../../Sources/AsyncTokens/async_token_batch_generator.h:7,
from ../../../Sources/cv_vid_bg_helpers.cpp:4:
/usr/include/c++/9/atomic:198:7: note: ‘std::atomic<_Tp>::atomic() noexcept [with _Tp = TSIntervalTimer::IntervalPair]’ is implicitly deleted because its exception-specification does not match the implicit exception-specification ‘’
198 | atomic() noexcept = default;
| ^~~~~~
[6/9] Building CXX object CMakeFiles/_core.dir/Sources/main.cpp.o
FAILED: CMakeFiles/_core.dir/Sources/main.cpp.o
/usr/bin/c++ -D_core_EXPORTS -Igenerated -I../../../Sources/AsyncTokens -I../../../Sources/ProcessorAlgos -I../../../Sources/ProcessorTokenHandlers -I../../../Sources/Utility -isystem /mnt/c/Downloads/opencv/build -isystem /mnt/c/Downloads/opencv/include -isystem /mnt/c/Downloads/opencv/modules/core/include -isystem /mnt/c/Downloads/opencv/modules/flann/include -isystem /mnt/c/Downloads/opencv/modules/imgproc/include -isystem /mnt/c/Downloads/opencv/modules/ml/include -isystem /mnt/c/Downloads/opencv/modules/photo/include -isystem /mnt/c/Downloads/opencv/modules/dnn/include -isystem /mnt/c/Downloads/opencv/modules/features2d/include -isystem /mnt/c/Downloads/opencv/modules/imgcodecs/include -isystem /mnt/c/Downloads/opencv/modules/videoio/include -isystem /mnt/c/Downloads/opencv/modules/calib3d/include -isystem /mnt/c/Downloads/opencv/modules/highgui/include -isystem /mnt/c/Downloads/opencv/modules/objdetect/include -isystem /mnt/c/Downloads/opencv/modules/stitching/include -isystem /mnt/c/Downloads/opencv/modules/ts/include -isystem /mnt/c/Downloads/opencv/modules/video/include -isystem /mnt/c/Downloads/opencv/modules/gapi/include -isystem /usr/include/python3.8 -isystem /tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/pybind11/include -isystem /tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/numpy/core/include -O3 -DNDEBUG -fPIC -fvisibility=hidden -flto -fno-fat-lto-objects -pthread -std=gnu++14 -MD -MT CMakeFiles/_core.dir/Sources/main.cpp.o -MF CMakeFiles/_core.dir/Sources/main.cpp.o.d -o CMakeFiles/_core.dir/Sources/main.cpp.o -c ../../../Sources/main.cpp
In file included from ../../../Sources/main.cpp:9:
../../../Sources/AsyncTokens/ts_interval_timer.h:109:46: error: use of deleted function ‘std::atomic<_Tp>::atomic() [with _Tp = TSIntervalTimer::IntervalPair]’
109 | std::atomic m_interval_record{};
| ^
In file included from ../../../Sources/AsyncTokens/ts_interval_timer.h:11,
from ../../../Sources/main.cpp:9:
/usr/include/c++/9/atomic:198:7: note: ‘std::atomic<_Tp>::atomic() noexcept [with _Tp = TSIntervalTimer::IntervalPair]’ is implicitly deleted because its exception-specification does not match the implicit exception-specification ‘’
198 | atomic() noexcept = default;
| ^~~~~~
[7/9] Building CXX object CMakeFiles/_core.dir/Sources/cv_vid_bubbletrack_helpers.cpp.o
FAILED: CMakeFiles/_core.dir/Sources/cv_vid_bubbletrack_helpers.cpp.o
/usr/bin/c++ -D_core_EXPORTS -Igenerated -I../../../Sources/AsyncTokens -I../../../Sources/ProcessorAlgos -I../../../Sources/ProcessorTokenHandlers -I../../../Sources/Utility -isystem /mnt/c/Downloads/opencv/build -isystem /mnt/c/Downloads/opencv/include -isystem /mnt/c/Downloads/opencv/modules/core/include -isystem /mnt/c/Downloads/opencv/modules/flann/include -isystem /mnt/c/Downloads/opencv/modules/imgproc/include -isystem /mnt/c/Downloads/opencv/modules/ml/include -isystem /mnt/c/Downloads/opencv/modules/photo/include -isystem /mnt/c/Downloads/opencv/modules/dnn/include -isystem /mnt/c/Downloads/opencv/modules/features2d/include -isystem /mnt/c/Downloads/opencv/modules/imgcodecs/include -isystem /mnt/c/Downloads/opencv/modules/videoio/include -isystem /mnt/c/Downloads/opencv/modules/calib3d/include -isystem /mnt/c/Downloads/opencv/modules/highgui/include -isystem /mnt/c/Downloads/opencv/modules/objdetect/include -isystem /mnt/c/Downloads/opencv/modules/stitching/include -isystem /mnt/c/Downloads/opencv/modules/ts/include -isystem /mnt/c/Downloads/opencv/modules/video/include -isystem /mnt/c/Downloads/opencv/modules/gapi/include -isystem /usr/include/python3.8 -isystem /tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/pybind11/include -isystem /tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/numpy/core/include -O3 -DNDEBUG -fPIC -fvisibility=hidden -flto -fno-fat-lto-objects -pthread -std=gnu++14 -MD -MT CMakeFiles/_core.dir/Sources/cv_vid_bubbletrack_helpers.cpp.o -MF CMakeFiles/_core.dir/Sources/cv_vid_bubbletrack_helpers.cpp.o.d -o CMakeFiles/_core.dir/Sources/cv_vid_bubbletrack_helpers.cpp.o -c ../../../Sources/cv_vid_bubbletrack_helpers.cpp
In file included from ../../../Sources/AsyncTokens/token_batch_generator.h:7,
from ../../../Sources/AsyncTokens/async_token_batch_generator.h:7,
from ../../../Sources/cv_vid_bubbletrack_helpers.cpp:5:
../../../Sources/AsyncTokens/ts_interval_timer.h:109:46: error: use of deleted function ‘std::atomic<_Tp>::atomic() [with _Tp = TSIntervalTimer::IntervalPair]’
109 | std::atomic m_interval_record{};
| ^
In file included from ../../../Sources/AsyncTokens/ts_interval_timer.h:11,
from ../../../Sources/AsyncTokens/token_batch_generator.h:7,
from ../../../Sources/AsyncTokens/async_token_batch_generator.h:7,
from ../../../Sources/cv_vid_bubbletrack_helpers.cpp:5:
/usr/include/c++/9/atomic:198:7: note: ‘std::atomic<_Tp>::atomic() noexcept [with _Tp = TSIntervalTimer::IntervalPair]’ is implicitly deleted because its exception-specification does not match the implicit exception-specification ‘’
198 | atomic() noexcept = default;
| ^~~~~~
ninja: build stopped: subcommand failed.
File "/tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 589, in setup
cmkr.make(make_args, env=env)
File "/tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/skbuild/cmaker.py", line 496, in make
raise SKBuildError(


-- Trying "Ninja" generator






--







-- Trying "Ninja" generator - success

Configuring Project
Working directory:
/tmp/pip-req-build-0iv3byhy/_skbuild/linux-x86_64-3.8/cmake-build
Command:
cmake /tmp/pip-req-build-0iv3byhy -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-req-build-0iv3byhy/_skbuild/linux-x86_64-3.8/cmake-install/PySources/cvvidproc -DPYTHON_EXECUTABLE:FILEPATH=/mnt/c/Users/andyl/envs/cvkoe/bin/python -DPYTHON_VERSION_STRING:STRING=3.8.5 -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.8 -DPYTHON_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libpython3.8.so -DSKBUILD:BOOL=TRUE -DCMAKE_MODULE_PATH:PATH=/tmp/pip-build-env-bxm2ypff/overlay/lib/python3.8/site-packages/skbuild/resources/cmake '-DCV_DIR:STRING='"'"'/mnt/c/Downloads/'"'"'' '-DCV_INSTALL_DIR:STRING='"'"'/mnt/c/Downloads/opencv/build/'"'"'' -DCMAKE_BUILD_TYPE:STRING=Release

Traceback (most recent call last):

An error occurred while building with CMake.
Command:
cmake --build . --target install --config Release --
Source directory:
/tmp/pip-req-build-0iv3byhy
Working directory:
/tmp/pip-req-build-0iv3byhy/_skbuild/linux-x86_64-3.8/cmake-build
Please see CMake's output for more information.

ERROR: Failed building wheel for cvvidproc
Failed to build cvvidproc
ERROR: Could not build wheels for cvvidproc which use PEP 517 and cannot be installed directly

Can't Install cvvidproc Based on README Directions

When in the ImgBackground folder, issuing the command from the README to install cvvidproc

<>
python3 setup.py --force-cmake --quiet install
<>

yields the following error message on my Ubuntu (18.04) terminal (tl;dr easy install doesn't have permission to write files to the Python distribution directory, but I don't know if I should grant them since easy install isn't particularly safe:

<>
copying PySources/cvvidproc/init.py -> _skbuild/linux-x86_64-3.8/cmake-install/PySources/cvvidproc/init.py

error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/test-easy-install-1481.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/usr/local/lib/python3.8/dist-packages/

Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

https://setuptools.readthedocs.io/en/latest/easy_install.html

Please make the appropriate changes for your system and try again.
<>

Demo C++ program cannot find video

The demo C++ program (built with cmake -S . -B Build -DCMAKE_BUILD_TYPE=Release followed by cmake --build Build) does not find the video file for analysis in either background computation or bubble-tracking:

"./Build/cvvidproc --vid_path=./Videos/ --vid=vid.mp4Video file not detected: /home/aylitalo/CvVidProc/Videos/vid.mp4
Background obtained in: 0.014 seconds
Background frame created was malformed, unexpectedly!

Tracking bubbles...
Video file not detected: /home/aylitalo/CvVidProc/Videos/vid.mp4
Bubbles tracked in: 0.003 seconds
Number of bubbles: 0

To demonstrate that a video indeed exists at the specified location:

aylitalo@DESKTOP-SNTHKND:~/CvVidProc$ ls /home/aylitalo/CvVidProc/Videos/
vid.mp4

ImportError in Python 3.8.5 & Build Error in g++ 9.3.0

Installing worked perfectly, thanks for patching up the package! I hit the following "ImportError" when I import inside a Python shell:

import cvvidproc as cv
Traceback (most recent call last):
File "", line 1, in
File "/mnt/c/Users/andyl/envs/cvkoe/lib/python3.8/site-packages/cvvidproc/init.py", line 4, in
from ._core import doc, VidBgPack, GetVideoBackground, HighlightBubblesPack, AssignBubblesPack, VidBubbleTrackPack, TrackBubbles
ImportError: /mnt/c/Users/andyl/envs/cvkoe/lib/python3.8/site-packages/cvvidproc/_core.cpython-38-x86_64-linux-gnu.so: undefined symbol: __atomic_compare_exchange_16

Similarly, in C++, the installation was perfect. The build also worked (with a few minor errors) but threw an error during linking ("[100%] Linking CXX executable cvvidproc"). The error message is long, but here's the preamble (and probably most relevant portion):

[100%] Linking CXX executable cvvidproc
/usr/bin/ld: CMakeFiles/cvvidproc.dir/Sources/main.cpp.o: in function main': main.cpp:(.text.startup+0x12a): undefined reference to __atomic_load_16'
/usr/bin/ld: main.cpp:(.text.startup+0x165): undefined reference to __atomic_compare_exchange_16' /usr/bin/ld: main.cpp:(.text.startup+0x17f): undefined reference to __atomic_load_16'

and the ending portion:

/usr/bin/ld: CMakeFiles/cvvidproc.dir/Sources/rand_tests.cpp.o: in function rand_tests::demo_trackbubbles(CommandLinePack&, cv::Mat&)': rand_tests.cpp:(.text+0x1627): undefined reference to __atomic_load_16'
/usr/bin/ld: rand_tests.cpp:(.text+0x1663): undefined reference to __atomic_compare_exchange_16' /usr/bin/ld: rand_tests.cpp:(.text+0x1678): undefined reference to __atomic_load_16'
/usr/bin/ld: CMakeFiles/cvvidproc.dir/Sources/rand_tests.cpp.o: in function rand_tests::test_timing_numpyconverter(int, bool)': rand_tests.cpp:(.text+0x1f39): undefined reference to __atomic_load_16'
/usr/bin/ld: rand_tests.cpp:(.text+0x1f73): undefined reference to __atomic_compare_exchange_16' /usr/bin/ld: rand_tests.cpp:(.text+0x1f99): undefined reference to __atomic_load_16'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/cvvidproc.dir/build.make:190: cvvidproc] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/cvvidproc.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

I'm using Python 3.8.5 and g++/gcc 9.3.0 on linux and have tried this on a virtual environment to make sure the peculiarities of other installed packages didn't interfere.

PS I found that this forum and this one discuss a similar error, but I don't understand how to implement their suggestions, so I thought I'd include links in case they're helpful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.