Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
with:
user: ${{ secrets.WPI_ARTIFACTORY_USERNAME }}
password: ${{ secrets.WPI_ARTIFACTORY_TOKEN }}
repository-url: https://wpilib.jfrog.io/artifactory/api/pypi/wpilib-python-release-2025-local
repository-url: https://wpilib.jfrog.io/artifactory/api/pypi/wpilib-python-release-2027-local
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

PYVERSION = 3.13
VERSION = 4.8.0
VERSION = 4.10.0

DOWNLOAD_FROM = https://github.com/opencv/opencv/archive/${VERSION}.tar.gz
LIBGZIP = $(abspath $(notdir ${DOWNLOAD_FROM}))
SRCDIR = opencv-$(VERSION)
BUILT_TGZ = OpenCV-$(VERSION)-arm.tar.gz
BUILT_TGZ = OpenCV-$(VERSION)-aarch64.tar.gz

.PHONY: all
all: package
Expand All @@ -29,7 +29,7 @@ package: ${BUILT_TGZ}
'*/lib/lib*so.408' \
'*/share/opencv4/haarcascades/*.xml' \
'*/share/opencv4/lbpcascades/*.xml'
roborio-gen-whl data-core.py coredata -o dist --strip arm-frc2024-linux-gnueabi-strip
roborio-gen-whl data-core.py coredata -o dist --strip aarch64-bookworm-linux-gnu-strip

# create dev package
mkdir -p devdata/usr/local/lib
Expand All @@ -44,4 +44,4 @@ package: ${BUILT_TGZ}
mkdir -p data/usr/local/lib/python$(PYVERSION)/site-packages
xtar -xf ${BUILT_TGZ} -C data/usr/local/lib/python$(PYVERSION)/site-packages --strip=4 \
'*/lib/python$(PYVERSION)/site-packages/cv2*.so'
roborio-gen-whl data-py.py data -o dist --strip arm-frc2024-linux-gnueabi-strip
roborio-gen-whl data-py.py data -o dist --strip aarch64-bookworm-linux-gnu-strip
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
OpenCV wheel builder for RoboRIO
================================
OpenCV wheel builder for Systemcore
===================================

Packages OpenCV in a wheel for installation on the RoboRIO.
Packages OpenCV in a wheel for installation on the Systemcore.

Usage
=====

You can install this on your RoboRIO by installing the `robotpy-opencv` package
You can install this on your Systemcore by installing the `robotpy-opencv` package
with `robotpy-installer` ([see the docs for details](https://robotpy.readthedocs.io/en/stable/install/robot.html)).

For detailed information about how to use OpenCV, see their [website](http://opencv.org/).
There's lots of documentation and tutorials/etc available.

The image processing section of the Programmer's Guide at the [RobotPy documentation site](http://robotpy.readthedocs.io)
also has some details for using OpenCV on a RoboRIO.
also has some details for using OpenCV on a Systemcore.
18 changes: 10 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash -e

OPENCV_VERSION=4.8.0
OPENCV_VERSION=4.10.0
PYTHON_VERSION=$(/build/venv/bin/cross-python -c 'import sys; print("%d.%d" % sys.version_info[:2])')
COMPILER=arm-frc2024-linux-gnueabi
COMPILER=aarch64-bookworm-linux-gnu

pushd `dirname $0`
ROOT=`pwd`
Expand All @@ -20,14 +20,14 @@ function assert_path {
fi
}

sed -i "s/arm-linux-gnueabi/$COMPILER/g" "$CVDIR"/platforms/linux/arm-gnueabi.toolchain.cmake
sed -i "s/aarch64-linux-gnu/$COMPILER/g" "$CVDIR"/platforms/linux/aarch64-gnu.toolchain.cmake

[ -d build ] || mkdir build
pushd build

PYTHON3_INCLUDE_PATH=/build/crosspy/include/python${PYTHON_VERSION}
PYTHON3_SITE_PACKAGES=/build/venv/cross/lib/python${PYTHON_VERSION}/site-packages/
PYTHON3_NUMPY_INCLUDE_DIRS="$PYTHON3_SITE_PACKAGES"/numpy/_core/include
PYTHON3_NUMPY_INCLUDE_DIRS="$BUILD"/numpy/_core/include

# Tried to compile with OpenBLAS support but cmake is weird..
#
Expand All @@ -41,7 +41,8 @@ PYTHON3_NUMPY_INCLUDE_DIRS="$PYTHON3_SITE_PACKAGES"/numpy/_core/include
# -DLAPACK_LIBRARIES=openblas \
# -DLAPACK_IMPL=OpenBLAS \

/build/venv/bin/cross-python -m pip --disable-pip-version-check install --prefer-binary numpy
/build/venv/bin/build-python -m pip download --platform=manylinux_2_28_aarch64 --only-binary=:all: numpy==2.3.1
unzip numpy*.whl

assert_path -d "$PYTHON3_INCLUDE_PATH"
#assert_path -f "$PYTHON3_LIBRARY"
Expand All @@ -55,10 +56,11 @@ CMAKE_PREFIX_PATH=/build/venv/cross cmake \
-DWITH_CUDA=OFF \
-DWITH_IPP=OFF \
-DWITH_ITT=OFF \
-DWITH_OPENCL=NO \
-DWITH_OPENCL=OFF \
-DWITH_FFMPEG=OFF \
-DWITH_OPENEXR=OFF \
-DWITH_GSTREAMER=OFF \
-DWITH_LAPACK=OFF \
-DWITH_GTK=OFF \
-DWITH_1394=OFF \
-DWITH_JASPER=OFF \
Expand All @@ -69,7 +71,7 @@ CMAKE_PREFIX_PATH=/build/venv/cross cmake \
-DBUILD_JPEG=ON -DBUILD_PNG=ON -DBUILD_ZLIB=ON \
\
-DOPENCV_GENERATE_PKGCONFIG=ON \
-DENABLE_NEON=ON -DENABLE_VFPV3=ON -DSOFTFP=ON \
-DENABLE_CXX11=ON \
\
-DBUILD_opencv_apps=OFF \
-DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF \
Expand All @@ -91,5 +93,5 @@ fi
make $MAKEARGS

cpack -G TGZ
mv OpenCV-${OPENCV_VERSION}-arm.tar.gz ${ROOT}/OpenCV-${OPENCV_VERSION}-arm.tar.gz
mv OpenCV-${OPENCV_VERSION}-aarch64.tar.gz ${ROOT}/OpenCV-${OPENCV_VERSION}-aarch64.tar.gz
popd
2 changes: 1 addition & 1 deletion data-core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "robotpy-opencv-core"
version = "4.8.0+r2"
version = "4.10.0"
url = "https://opencv.org"
license = "Apache 2"
install_requires = ["numpy"]
2 changes: 1 addition & 1 deletion data-py.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "robotpy-opencv"
version = "4.8.0+r2"
version = "4.10.0"
url = "https://opencv.org"
license = "Apache 2"
install_requires = ["numpy", f"robotpy-opencv-core=={version}"]
4 changes: 2 additions & 2 deletions toolchain.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.1)
set(ARM_PREFIX arm-frc2024-linux-gnueabi)
set(ARM_PREFIX aarch64-bookworm-linux-gnu)

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
Expand All @@ -13,4 +13,4 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

include("${CMAKE_CURRENT_LIST_DIR}/opencv-4.8.0/platforms/linux/arm-gnueabi.toolchain.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/opencv-4.10.0/platforms/linux/aarch64-gnu.toolchain.cmake")
Loading