Skip to content

Commit cc7304c

Browse files
committed
Adjust to the OpenCV 4.11.0
1 parent ab2a474 commit cc7304c

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

.github/workflows/opencv-rust.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
- ubuntu-22.04
1616
- macos-14
1717
opencv-version:
18-
- 4.10.0
18+
- 4.11.0
1919
linkage:
2020
- dynamic
2121
include:
2222
- os-image: ubuntu-22.04
23-
opencv-version: 4.10.0
23+
opencv-version: 4.11.0
2424
linkage: static
2525
- os-image: ubuntu-22.04
2626
opencv-version: 3.4.20
@@ -142,7 +142,7 @@ jobs:
142142
msrv:
143143
runs-on: ubuntu-20.04
144144
env:
145-
OPENCV_VERSION: 4.10.0
145+
OPENCV_VERSION: 4.11.0
146146
SCCACHE_GHA_ENABLED: "true"
147147
RUSTC_WRAPPER: "sccache"
148148
CMAKE_C_COMPILER_LAUNCHER: "sccache"

ci/script.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ elif [[ "$os_family" == "Linux" ]]; then
7171
fi
7272

7373
# remove tests and examples that require the latest OpenCV version so that they don't fail due to missing modules
74-
if [[ "${OPENCV_VERSION:-}" != "4.10.0" ]]; then
74+
if [[ "${OPENCV_VERSION:-}" != "4.11.0" ]]; then
7575
rm -vf tests/*_only_latest_opencv.rs
76-
rm -vf examples/dnn_face_detect.rs examples/text_detection.rs examples/camera_calibration.rs
76+
rm -vf examples/dnn_face_detect.rs examples/text_detection.rs examples/camera_calibration.rs examples/hough_circle.rs
7777
fi
7878

7979
echo "=== Current directory: $(pwd)"

examples/hough_circle.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::env::args;
44
use std::sync::atomic::{AtomicI32, Ordering};
55
use std::sync::Arc;
66

7-
use opencv::core::{find_file, Point, Point2i, Size2i, Vec3f, Vector, BORDER_DEFAULT};
7+
use opencv::core::{find_file, AlgorithmHint, Point, Point2i, Size2i, Vec3f, Vector, BORDER_DEFAULT};
88
use opencv::highgui::{create_trackbar, imshow, named_window, wait_key, WINDOW_AUTOSIZE};
99
use opencv::imgcodecs::{imread, IMREAD_COLOR};
1010
use opencv::imgproc::{circle, cvt_color_def, gaussian_blur, hough_circles, COLOR_BGR2GRAY, HOUGH_GRADIENT};
@@ -89,7 +89,15 @@ fn main() -> Result<()> {
8989

9090
// Reduce the noise so we avoid false circle detection
9191
let mut src_gray_blur = Mat::default();
92-
gaussian_blur(&src_gray, &mut src_gray_blur, Size2i::new(9, 9), 2.0, 2.0, BORDER_DEFAULT)?;
92+
gaussian_blur(
93+
&src_gray,
94+
&mut src_gray_blur,
95+
Size2i::new(9, 9),
96+
2.0,
97+
2.0,
98+
BORDER_DEFAULT,
99+
AlgorithmHint::ALGO_HINT_DEFAULT,
100+
)?;
93101

94102
// Declare and initialize both parameters that are subjects to change
95103
let canny_threshold: Arc<AtomicI32> = Arc::new(AtomicI32::new(CANNY_THRESHOLD_INIT_VAL));

examples/text_detection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub fn main() -> Result<()> {
104104
// Text Recognition
105105
let rec_input = if !imread_rgb {
106106
let mut rec_input = Mat::default();
107-
imgproc::cvt_color(&frame, &mut rec_input, imgproc::COLOR_BGR2GRAY, 0)?;
107+
imgproc::cvt_color_def(&frame, &mut rec_input, imgproc::COLOR_BGR2GRAY)?;
108108
Some(rec_input)
109109
} else {
110110
None

0 commit comments

Comments
 (0)