diff --git a/.gitignore b/.gitignore index e3a4adb6a3..6a5475d8f5 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,5 @@ bgslibrary_gui upload.sh *.code-workspace env +bgslibrary_env +bgslibrary_test_env diff --git a/demo2.py b/demo2.py index befb409a78..943887e6a0 100644 --- a/demo2.py +++ b/demo2.py @@ -45,13 +45,23 @@ def check_opencv_version(major): algorithms.append(bgs.TwoPoints()) algorithms.append(bgs.ViBe()) algorithms.append(bgs.CodeBook()) +algorithms.append(bgs.FuzzySugenoIntegral()) +algorithms.append(bgs.FuzzyChoquetIntegral()) +algorithms.append(bgs.LBSimpleGaussian()) +algorithms.append(bgs.LBFuzzyGaussian()) +algorithms.append(bgs.LBMixtureOfGaussians()) +algorithms.append(bgs.LBAdaptiveSOM()) +algorithms.append(bgs.LBFuzzyAdaptiveSOM()) +algorithms.append(bgs.VuMeter()) +algorithms.append(bgs.KDE()) +algorithms.append(bgs.IndependentMultimodal()) if is_cv2(): algorithms.append(bgs.MixtureOfGaussianV1()) # if opencv 2.x algorithms.append(bgs.GMG()) # if opencv 2.x -if is_cv3(): - algorithms.append(bgs.KNN()) # if opencv 3.x +if not is_cv2(): + algorithms.append(bgs.KNN()) # if opencv > 2 if is_cv2() or is_cv3(): algorithms.append(bgs.DPAdaptiveMedian()) @@ -66,16 +76,6 @@ def check_opencv_version(major): algorithms.append(bgs.T2FGMM_UV()) algorithms.append(bgs.T2FMRF_UM()) algorithms.append(bgs.T2FMRF_UV()) - algorithms.append(bgs.FuzzySugenoIntegral()) - algorithms.append(bgs.FuzzyChoquetIntegral()) - algorithms.append(bgs.LBSimpleGaussian()) - algorithms.append(bgs.LBFuzzyGaussian()) - algorithms.append(bgs.LBMixtureOfGaussians()) - algorithms.append(bgs.LBAdaptiveSOM()) - algorithms.append(bgs.LBFuzzyAdaptiveSOM()) - algorithms.append(bgs.VuMeter()) - algorithms.append(bgs.KDE()) - algorithms.append(bgs.IndependentMultimodal()) algorithms.append(bgs.MultiCue()) if is_cv2() or is_lower_or_equals_cv347(): @@ -93,7 +93,7 @@ def check_opencv_version(major): video_file = "dataset/video.avi" - +print("Number of available algorithms: ", len(algorithms)) for algorithm in algorithms: print("Running ", algorithm.__class__) diff --git a/virtualenv-build-test-publish.sh b/virtualenv-build-test-publish.sh new file mode 100644 index 0000000000..9f3a9cd723 --- /dev/null +++ b/virtualenv-build-test-publish.sh @@ -0,0 +1,46 @@ +# Remove the existing virtual environment if it exists +rm -rf bgslibrary_env + +# Create a new virtual environment called bgslibrary_env using Python3 +python3 -m venv bgslibrary_env + +# Activate the newly created virtual environment +source bgslibrary_env/bin/activate + +# Upgrade pip and install required packages numpy and OpenCV +python -m pip install --upgrade pip +python -m pip install wheel +python -m pip install numpy +python -m pip install opencv-python + +# Build and install the package using the setup.py script +python setup.py build +python setup.py install + +# Set the PYTHONPATH environment variable to the build directory to access the installed library +# The following line is for Linux +export PYTHONPATH=$PYTHONPATH:$PWD/build/lib.linux-x86_64-cpython-38 +# The following line is for Mac +export PYTHONPATH=$PYTHONPATH:$PWD/build/lib.macosx-11-x86_64-cpython-39 + +# Run demo.py and demo2.py to verify the package installation +python demo.py +python demo2.py + +# Install the Twine package for uploading the distribution packages +python -m pip install twine + +# Remove any existing build directory +rm -rf build/* + +# Build a Wheel distribution package for the project +python setup.py bdist_wheel + +# Upload any generated Wheel distribution packages using Twine +twine upload dist/*.whl + +# Create a source distribution package for the project +python setup.py sdist + +# Upload the generated source distribution package using Twine +twine upload dist/pybgs-*.tar.gz diff --git a/virtualenv-install-test.sh b/virtualenv-install-test.sh new file mode 100644 index 0000000000..70958661cb --- /dev/null +++ b/virtualenv-install-test.sh @@ -0,0 +1,30 @@ +# Remove the existing virtual environment if it exists +rm -rf bgslibrary_test_env + +# Create a new virtual environment called bgslibrary_test_env using Python3 +python3 -m venv bgslibrary_test_env + +# Activate the newly created virtual environment +source bgslibrary_test_env/bin/activate + +# Upgrade pip and install required packages numpy and OpenCV +python -m pip install --upgrade pip +python -m pip install numpy +python -m pip install opencv-python + +# Build and install the package using the setup.py script +# python setup.py build +# python setup.py install + +# Set the PYTHONPATH environment variable to the build directory to access the installed library +# The following line is for Linux +# export PYTHONPATH=$PYTHONPATH:$PWD/build/lib.linux-x86_64-cpython-38 +# The following line is for Mac +# export PYTHONPATH=$PYTHONPATH:$PWD/build/lib.macosx-11-x86_64-cpython-39 + +# Install the pybgs directly from PyPI +python -m pip install pybgs + +# Run demo.py and demo2.py to verify the package installation +python demo.py +python demo2.py