mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
cleanup point transform code
This commit is contained in:
@@ -16,7 +16,8 @@
|
||||
|
||||
use crate::{
|
||||
common::{
|
||||
detector::WhiteRectangleDetector, BitMatrix, DefaultGridSampler, GridSampler, Result, Quadrilateral,
|
||||
detector::WhiteRectangleDetector, BitMatrix, DefaultGridSampler, GridSampler,
|
||||
Quadrilateral, Result,
|
||||
},
|
||||
point, Exceptions, Point,
|
||||
};
|
||||
@@ -334,15 +335,15 @@ 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);
|
||||
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,
|
||||
dst, src
|
||||
)
|
||||
sampler.sample_grid_detailed(image, dimensionX, dimensionY, dst, src)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,13 +14,14 @@ macro_rules! CHECK {
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
use crate::{
|
||||
common::{BitMatrix, DefaultGridSampler, GridSampler, Result, Quadrilateral},
|
||||
common::{BitMatrix, DefaultGridSampler, GridSampler, Quadrilateral, Result},
|
||||
datamatrix::detector::{
|
||||
zxing_cpp_detector::{util::intersect, BitMatrixCursor, RegressionLine},
|
||||
DatamatrixDetectorResult,
|
||||
},
|
||||
point,
|
||||
qrcode::encoder::ByteMatrix,
|
||||
Exceptions, Point, point,
|
||||
Exceptions, Point,
|
||||
};
|
||||
|
||||
use super::{DMRegressionLine, EdgeTracer};
|
||||
@@ -212,15 +213,16 @@ fn Scan(
|
||||
|
||||
let grid_sampler = DefaultGridSampler::default();
|
||||
// let transform = PerspectiveTransform::quadrilateralToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3, x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p);
|
||||
let dst = Quadrilateral::new(point(0.0,0.0), point(dimT as f32, 0.0), point(dimT as f32, dimR as f32), point(0.0, dimR as f32));
|
||||
let src = sourcePoints;
|
||||
|
||||
let res = grid_sampler.sample_grid_detailed(
|
||||
startTracer.img,
|
||||
dimT as u32,
|
||||
dimR as u32,
|
||||
dst, src
|
||||
let dst = Quadrilateral::new(
|
||||
point(0.0, 0.0),
|
||||
point(dimT as f32, 0.0),
|
||||
point(dimT as f32, dimR as f32),
|
||||
point(0.0, dimR as f32),
|
||||
);
|
||||
let src = sourcePoints;
|
||||
|
||||
let res =
|
||||
grid_sampler.sample_grid_detailed(startTracer.img, dimT as u32, dimR as u32, dst, src);
|
||||
|
||||
// let res = grid_sampler.sample_grid(startTracer.img, dimT as u32, dimR as u32, &transform);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user