mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-28 05:12:34 +00:00
fix pattern test
This commit is contained in:
@@ -412,7 +412,12 @@ pub fn FitQadrilateralToPoints(center: Point, points: &mut [Point]) -> Option<Qu
|
||||
.max_by(diagonal_max_by_pred)?;
|
||||
// corners[3] = std::max_element(&points[Size(points) * 5 / 8], &points[Size(points) * 7 / 8], dist2Diagonal);
|
||||
|
||||
let corner_positions = [0, points.iter().position(|p| *p == corners[1])?, points.iter().position(|p| *p == corners[2])?, points.iter().position(|p| *p == corners[3])?];
|
||||
let corner_positions = [
|
||||
0,
|
||||
points.iter().position(|p| *p == corners[1])?,
|
||||
points.iter().position(|p| *p == corners[2])?,
|
||||
points.iter().position(|p| *p == corners[3])?,
|
||||
];
|
||||
|
||||
// let lines = [
|
||||
// RegressionLine::with_two_points(corners[0] + 1.0, corners[1]),
|
||||
|
||||
@@ -163,7 +163,7 @@ impl<'a> PatternView<'a> {
|
||||
|
||||
// index is the number of bars and spaces from the first bar to the current position
|
||||
pub fn index(&self) -> usize {
|
||||
self.current - self.start /*return narrow_cast<int>(_data - _base) - 1;*/
|
||||
self.current /*return narrow_cast<int>(_data - _base) - 1;*/
|
||||
}
|
||||
pub fn pixelsInFront(&self) -> PatternType {
|
||||
self.data
|
||||
|
||||
@@ -715,7 +715,10 @@ pub fn SampleQR(image: &BitMatrix, fp: &FinderPatternSet) -> Result<QRCodeDetect
|
||||
let y1 = apM[y + 1];
|
||||
rois.push(SamplerControl {
|
||||
p0: point_i(x0 - u32::from(x == 0) * 6, y0 - u32::from(y == 0) * 6),
|
||||
p1: point_i(x1 + u32::from(x == N - 1) * 7, y1 + u32::from(y == N - 1) * 7),
|
||||
p1: point_i(
|
||||
x1 + u32::from(x == N - 1) * 7,
|
||||
y1 + u32::from(y == N - 1) * 7,
|
||||
),
|
||||
transform: PerspectiveTransform::quadrilateralToQuadrilateral(
|
||||
Quadrilateral::rectangle_from_xy(
|
||||
x0 as f32, x1 as f32, y0 as f32, y1 as f32, None,
|
||||
|
||||
@@ -284,7 +284,7 @@ impl Point {
|
||||
pub fn floor(self) -> Self {
|
||||
Self {
|
||||
x: self.x.floor(),
|
||||
y: self.y.floor()
|
||||
y: self.y.floor(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user