Skip to content

Commit 5af4ef8

Browse files
committed
tooling: Update OpenCV to v4.13.0
1 parent 6bdd99c commit 5af4ef8

File tree

5 files changed

+174
-7
lines changed

5 files changed

+174
-7
lines changed

oasis_tooling/config/bgslibrary/0001-Disable-imshow-calls.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
From 47058cd9c7f7a3bfebca8a74075eaf953d325232 Mon Sep 17 00:00:00 2001
1+
From 780fb0dc93326499de403776eb5b01cd43a4dc68 Mon Sep 17 00:00:00 2001
22
From: Garrett Brown <eigendebugger@gmail.com>
33
Date: Fri, 21 Mar 2025 21:38:12 -0700
4-
Subject: [PATCH 1/2] Disable imshow() calls
4+
Subject: [PATCH 1/3] Disable imshow() calls
55

66
---
77
CMakeLists.txt | 3 ++
88
bgslibrary/tools/PerformanceUtils.cpp | 49 ---------------------------
99
2 files changed, 3 insertions(+), 49 deletions(-)
1010

1111
diff --git a/CMakeLists.txt b/CMakeLists.txt
12-
index 4d635ff..fc2b51d 100644
12+
index 2ff5217..09a8cfe 100644
1313
--- a/CMakeLists.txt
1414
+++ b/CMakeLists.txt
1515
@@ -67,6 +67,9 @@ foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})

oasis_tooling/config/bgslibrary/0002-CMake-Fix-locating-libs-via-_ROOT-variables.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
From 74fc9828431845d5e1aff3a5527a4142d8cc7a33 Mon Sep 17 00:00:00 2001
1+
From cfaca08a7d9346b07fbfd25eff451a147c98ad1d Mon Sep 17 00:00:00 2001
22
From: Garrett Brown <garrett.brown@aclima.earth>
33
Date: Wed, 24 Sep 2025 14:09:45 -0700
4-
Subject: [PATCH 2/2] CMake: Fix locating libs via *_ROOT variables
4+
Subject: [PATCH 2/3] CMake: Fix locating libs via *_ROOT variables
55

66
---
77
CMakeLists.txt | 5 +++++
88
1 file changed, 5 insertions(+)
99

1010
diff --git a/CMakeLists.txt b/CMakeLists.txt
11-
index fc2b51d..c5d5e1d 100644
11+
index 09a8cfe..744a61e 100644
1212
--- a/CMakeLists.txt
1313
+++ b/CMakeLists.txt
1414
@@ -35,6 +35,11 @@ if (POLICY CMP0042)
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
From e50015edd252f5aef9fb3b09d7d1c0a58d7c9774 Mon Sep 17 00:00:00 2001
2+
From: Garrett Brown <garrett.brown@aclima.earth>
3+
Date: Sat, 7 Feb 2026 12:07:04 -0800
4+
Subject: [PATCH 3/3] Implement OpenCV4 required apply() overload
5+
6+
---
7+
bgslibrary/algorithms/LBSP/BackgroundSubtractorLBSP.h | 11 +++++++++++
8+
.../algorithms/LBSP/BackgroundSubtractorLBSP_.h | 11 +++++++++++
9+
.../algorithms/LBSP/BackgroundSubtractorLOBSTER.h | 11 +++++++++++
10+
.../algorithms/LBSP/BackgroundSubtractorPAWCS.h | 11 +++++++++++
11+
.../algorithms/LBSP/BackgroundSubtractorSuBSENSE.h | 11 +++++++++++
12+
5 files changed, 55 insertions(+)
13+
14+
diff --git a/bgslibrary/algorithms/LBSP/BackgroundSubtractorLBSP.h b/bgslibrary/algorithms/LBSP/BackgroundSubtractorLBSP.h
15+
index 3744b8c..be5bfee 100644
16+
--- a/bgslibrary/algorithms/LBSP/BackgroundSubtractorLBSP.h
17+
+++ b/bgslibrary/algorithms/LBSP/BackgroundSubtractorLBSP.h
18+
@@ -22,6 +22,8 @@ namespace bgslibrary
19+
*/
20+
class BackgroundSubtractorLBSP : public cv::BackgroundSubtractor {
21+
public:
22+
+ using cv::BackgroundSubtractor::apply;
23+
+
24+
//! full constructor
25+
BackgroundSubtractorLBSP(float fRelLBSPThreshold, size_t nLBSPThresholdOffset = 0);
26+
//! default destructor
27+
@@ -32,6 +34,15 @@ namespace bgslibrary
28+
virtual void initialize(const cv::Mat& oInitImg, const cv::Mat& oROI) = 0;
29+
//! primary model update function; the learning param is used to override the internal learning speed (ignored when <= 0)
30+
virtual void apply(cv::InputArray image, cv::OutputArray fgmask, double learningRate = 0) = 0;
31+
+ // add OpenCV4 overloaded apply that takes a knownForegroundMask
32+
+ void apply(cv::InputArray image,
33+
+ cv::InputArray knownForegroundMask,
34+
+ cv::OutputArray fgmask,
35+
+ double learningRate = -1) CV_OVERRIDE
36+
+ {
37+
+ (void)knownForegroundMask; // ignore this mask by default
38+
+ apply(image, fgmask, learningRate); // forward to existing implementation
39+
+ }
40+
//! unused, always returns nullptr
41+
//virtual cv::AlgorithmInfo* info() const;
42+
//! returns a copy of the ROI used for descriptor extraction
43+
diff --git a/bgslibrary/algorithms/LBSP/BackgroundSubtractorLBSP_.h b/bgslibrary/algorithms/LBSP/BackgroundSubtractorLBSP_.h
44+
index 79d6df9..04eb4ac 100644
45+
--- a/bgslibrary/algorithms/LBSP/BackgroundSubtractorLBSP_.h
46+
+++ b/bgslibrary/algorithms/LBSP/BackgroundSubtractorLBSP_.h
47+
@@ -22,6 +22,8 @@ namespace bgslibrary
48+
*/
49+
class BackgroundSubtractorLBSP_ : public cv::BackgroundSubtractor {
50+
public:
51+
+ using cv::BackgroundSubtractor::apply;
52+
+
53+
//! full constructor
54+
BackgroundSubtractorLBSP_(float fRelLBSPThreshold, size_t nLBSPThresholdOffset = 0);
55+
//! default destructor
56+
@@ -32,6 +34,15 @@ namespace bgslibrary
57+
virtual void initialize(const cv::Mat& oInitImg, const cv::Mat& oROI) = 0;
58+
//! primary model update function; the learning param is used to override the internal learning speed (ignored when <= 0)
59+
virtual void apply(cv::InputArray image, cv::OutputArray fgmask, double learningRate = 0) = 0;
60+
+ // add OpenCV4 overloaded apply that takes a knownForegroundMask
61+
+ void apply(cv::InputArray image,
62+
+ cv::InputArray knownForegroundMask,
63+
+ cv::OutputArray fgmask,
64+
+ double learningRate = -1) CV_OVERRIDE
65+
+ {
66+
+ (void)knownForegroundMask; // ignore this mask by default
67+
+ apply(image, fgmask, learningRate); // forward to existing implementation
68+
+ }
69+
//! unused, always returns nullptr
70+
//virtual cv::AlgorithmInfo* info() const;
71+
//! returns a copy of the ROI used for descriptor extraction
72+
diff --git a/bgslibrary/algorithms/LBSP/BackgroundSubtractorLOBSTER.h b/bgslibrary/algorithms/LBSP/BackgroundSubtractorLOBSTER.h
73+
index b7860a1..3dd38fd 100644
74+
--- a/bgslibrary/algorithms/LBSP/BackgroundSubtractorLOBSTER.h
75+
+++ b/bgslibrary/algorithms/LBSP/BackgroundSubtractorLOBSTER.h
76+
@@ -36,6 +36,8 @@ namespace bgslibrary
77+
*/
78+
class BackgroundSubtractorLOBSTER : public BackgroundSubtractorLBSP {
79+
public:
80+
+ using cv::BackgroundSubtractor::apply;
81+
+
82+
//! full constructor
83+
BackgroundSubtractorLOBSTER(float fRelLBSPThreshold = BGSLOBSTER_DEFAULT_LBSP_REL_SIMILARITY_THRESHOLD,
84+
size_t nLBSPThresholdOffset = BGSLOBSTER_DEFAULT_LBSP_OFFSET_SIMILARITY_THRESHOLD,
85+
@@ -51,6 +53,15 @@ namespace bgslibrary
86+
virtual void refreshModel(float fSamplesRefreshFrac, bool bForceFGUpdate = false);
87+
//! primary model update function; the learning param is reinterpreted as an integer and should be > 0 (smaller values == faster adaptation)
88+
virtual void apply(cv::InputArray image, cv::OutputArray fgmask, double learningRateOverride = BGSLOBSTER_DEFAULT_LEARNING_RATE);
89+
+ // add OpenCV4 overloaded apply that takes a knownForegroundMask
90+
+ void apply(cv::InputArray image,
91+
+ cv::InputArray knownForegroundMask,
92+
+ cv::OutputArray fgmask,
93+
+ double learningRate = -1) CV_OVERRIDE
94+
+ {
95+
+ (void)knownForegroundMask; // ignore this mask by default
96+
+ apply(image, fgmask, learningRate); // forward to existing implementation
97+
+ }
98+
//! returns a copy of the latest reconstructed background image
99+
void getBackgroundImage(cv::OutputArray backgroundImage) const;
100+
//! returns a copy of the latest reconstructed background descriptors image
101+
diff --git a/bgslibrary/algorithms/LBSP/BackgroundSubtractorPAWCS.h b/bgslibrary/algorithms/LBSP/BackgroundSubtractorPAWCS.h
102+
index e81736d..925e601 100644
103+
--- a/bgslibrary/algorithms/LBSP/BackgroundSubtractorPAWCS.h
104+
+++ b/bgslibrary/algorithms/LBSP/BackgroundSubtractorPAWCS.h
105+
@@ -32,6 +32,8 @@ namespace bgslibrary
106+
*/
107+
class BackgroundSubtractorPAWCS : public BackgroundSubtractorLBSP_ {
108+
public:
109+
+ using cv::BackgroundSubtractor::apply;
110+
+
111+
//! full constructor
112+
BackgroundSubtractorPAWCS(float fRelLBSPThreshold = BGSPAWCS_DEFAULT_LBSP_REL_SIMILARITY_THRESHOLD,
113+
size_t nDescDistThresholdOffset = BGSPAWCS_DEFAULT_DESC_DIST_THRESHOLD_OFFSET,
114+
@@ -46,6 +48,15 @@ namespace bgslibrary
115+
virtual void refreshModel(size_t nBaseOccCount, float fOccDecrFrac, bool bForceFGUpdate = false);
116+
//! primary model update function; the learning param is used to override the internal learning speed (ignored when <= 0)
117+
virtual void apply(cv::InputArray image, cv::OutputArray fgmask, double learningRateOverride = 0);
118+
+ // add OpenCV4 overloaded apply that takes a knownForegroundMask
119+
+ void apply(cv::InputArray image,
120+
+ cv::InputArray knownForegroundMask,
121+
+ cv::OutputArray fgmask,
122+
+ double learningRate = -1) CV_OVERRIDE
123+
+ {
124+
+ (void)knownForegroundMask; // ignore this mask by default
125+
+ apply(image, fgmask, learningRate); // forward to existing implementation
126+
+ }
127+
//! returns a copy of the latest reconstructed background image
128+
virtual void getBackgroundImage(cv::OutputArray backgroundImage) const;
129+
//! returns a copy of the latest reconstructed background descriptors image
130+
diff --git a/bgslibrary/algorithms/LBSP/BackgroundSubtractorSuBSENSE.h b/bgslibrary/algorithms/LBSP/BackgroundSubtractorSuBSENSE.h
131+
index 9ec95e1..aabe129 100644
132+
--- a/bgslibrary/algorithms/LBSP/BackgroundSubtractorSuBSENSE.h
133+
+++ b/bgslibrary/algorithms/LBSP/BackgroundSubtractorSuBSENSE.h
134+
@@ -34,6 +34,8 @@ namespace bgslibrary
135+
*/
136+
class BackgroundSubtractorSuBSENSE : public BackgroundSubtractorLBSP {
137+
public:
138+
+ using cv::BackgroundSubtractor::apply;
139+
+
140+
//! full constructor
141+
BackgroundSubtractorSuBSENSE(float fRelLBSPThreshold = BGSSUBSENSE_DEFAULT_LBSP_REL_SIMILARITY_THRESHOLD,
142+
size_t nDescDistThresholdOffset = BGSSUBSENSE_DEFAULT_DESC_DIST_THRESHOLD_OFFSET,
143+
@@ -49,6 +51,15 @@ namespace bgslibrary
144+
virtual void refreshModel(float fSamplesRefreshFrac, bool bForceFGUpdate = false);
145+
//! primary model update function; the learning param is used to override the internal learning thresholds (ignored when <= 0)
146+
virtual void apply(cv::InputArray image, cv::OutputArray fgmask, double learningRateOverride = 0);
147+
+ // add OpenCV4 overloaded apply that takes a knownForegroundMask
148+
+ void apply(cv::InputArray image,
149+
+ cv::InputArray knownForegroundMask,
150+
+ cv::OutputArray fgmask,
151+
+ double learningRate = -1) CV_OVERRIDE
152+
+ {
153+
+ (void)knownForegroundMask; // ignore this mask by default
154+
+ apply(image, fgmask, learningRate); // forward to existing implementation
155+
+ }
156+
//! returns a copy of the latest reconstructed background image
157+
void getBackgroundImage(cv::OutputArray backgroundImage) const;
158+
//! returns a copy of the latest reconstructed background descriptors image
159+
--
160+
2.43.0
161+

oasis_tooling/scripts/depinstall_oasis_deps.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ patch \
222222
--no-backup-if-mismatch \
223223
--directory="${OASIS_DEPENDS_SOURCE_DIRECTORY}/ros-perception/bgslibrary" \
224224
< "${CONFIG_DIRECTORY}/bgslibrary/0002-CMake-Fix-locating-libs-via-_ROOT-variables.patch"
225+
patch \
226+
-p1 \
227+
--reject-file="/dev/null" \
228+
--no-backup-if-mismatch \
229+
--directory="${OASIS_DEPENDS_SOURCE_DIRECTORY}/ros-perception/bgslibrary" \
230+
< "${CONFIG_DIRECTORY}/bgslibrary/0003-Implement-OpenCV4-required-apply-overload.patch"
225231

226232
# camera_ros
227233
echo "Patching camera_ros..."

oasis_tooling/scripts/env_cv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set -o nounset
1919
#
2020

2121
# Version
22-
OPENCV_VERSION="4.12.0"
22+
OPENCV_VERSION="4.13.0"
2323

2424
# Extract major version (everything before the first '.')
2525
OPENCV_MAJOR_VERSION="${OPENCV_VERSION%%.*}"

0 commit comments

Comments
 (0)