Promote Quadrilateral to default

The library now uses the `Quadrilateral` struct when handling sets of four points in `GridSampler` and `PerspectiveTransform`
This commit is contained in:
Henry Schimke
2023-03-08 11:17:43 -06:00
parent d5e6a5d0a7
commit 2b7d053646
13 changed files with 348 additions and 422 deletions

View File

@@ -16,7 +16,7 @@
use crate::{
common::{
detector::WhiteRectangleDetector, BitMatrix, DefaultGridSampler, GridSampler, Result,
detector::WhiteRectangleDetector, BitMatrix, DefaultGridSampler, GridSampler, Result, Quadrilateral,
},
point, Exceptions, Point,
};
@@ -334,26 +334,14 @@ impl<'a> Detector<'_> {
) -> Result<BitMatrix> {
let sampler = DefaultGridSampler::default();
let dst = Quadrilateral::new(point(0.5, 0.5), point(dimensionX as f32 - 0.5, 0.5), point(dimensionX as f32 - 0.5,dimensionY as f32 - 0.5), point(0.5, dimensionY as f32 - 0.5));
let src = Quadrilateral::new(topRight, topLeft,bottomRight, bottomLeft);
sampler.sample_grid_detailed(
image,
dimensionX,
dimensionY,
0.5,
0.5,
dimensionX as f32 - 0.5,
0.5,
dimensionX as f32 - 0.5,
dimensionY as f32 - 0.5,
0.5,
dimensionY as f32 - 0.5,
topLeft.x,
topLeft.y,
topRight.x,
topRight.y,
bottomRight.x,
bottomRight.y,
bottomLeft.x,
bottomLeft.y,
dst, src
)
}