Skip to content

Commit 94a31cf

Browse files
committed
draw only centroid for rect2d
1 parent de67c8c commit 94a31cf

3 files changed

Lines changed: 18 additions & 11 deletions

File tree

src/vision/gate_poles.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ use anyhow::Result;
22
use derive_getters::Getters;
33
use itertools::MergeJoinBy;
44
use opencv::core::{multiply, multiply_def, MatTraitManual, BORDER_CONSTANT, CV_8U};
5-
use opencv::imgproc::{get_structuring_element, morphology_default_border_value, MORPH_RECT};
5+
use opencv::imgproc::{
6+
dilate_def, get_structuring_element, morphology_default_border_value, MORPH_RECT,
7+
};
68
use opencv::{
79
core::{in_range, merge, split, Point, Scalar, Size, Vector},
810
imgproc::{

src/vision/mod.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,20 @@ impl RelPos for DrawRect2d {
291291

292292
impl Draw for DrawRect2d {
293293
fn draw(&self, canvas: &mut Mat) -> Result<()> {
294-
imgproc::rectangle(
295-
canvas,
296-
self.inner
297-
.to()
298-
.ok_or(anyhow!("f64 outside bounds of i32"))?,
299-
Scalar::from((0.0, 0.0, 255.0)),
300-
2,
301-
LINE_8,
302-
0,
303-
)?;
294+
// imgproc::rectangle(
295+
// canvas,
296+
// self.inner
297+
// .to()
298+
// .ok_or(anyhow!("f64 outside bounds of i32"))?,
299+
// Scalar::from((0.0, 0.0, 255.0)),
300+
// 2,
301+
// LINE_8,
302+
// 0,
303+
// )?;
304+
305+
let center = Point::new((self.x as i32), (self.y as i32));
306+
307+
imgproc::circle_def(canvas, center, 5, Scalar::from((0.0, 0.0, 255.0)))?;
304308
Ok(())
305309
}
306310
}

src/vision/yolo_model.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ impl<T: Display> Draw for VisualDetection<YoloClass<T>, DrawRect2d> {
8585
LINE_AA,
8686
false,
8787
)?;
88+
8889
Ok(())
8990
}
9091
}

0 commit comments

Comments
 (0)