partial success on parse, missing symbology id

This commit is contained in:
Henry Schimke
2023-04-22 16:17:05 -05:00
parent 789719d3eb
commit bec7c99dbb
11 changed files with 34 additions and 18 deletions

View File

@@ -91,7 +91,7 @@ pub fn ReadFormatInformation(bitMatrix: &BitMatrix, isMicro: bool) -> Result<For
AppendBit(&mut formatInfoBits1, getBit(bitMatrix, 8, 8, None));
AppendBit(&mut formatInfoBits1, getBit(bitMatrix, 8, 7, None));
// .. and skip a bit in the timing pattern ...
for y in (0..=6).rev() {
for y in (0..=5).rev() {
// for (int y = 5; y >= 0; y--)
AppendBit(&mut formatInfoBits1, getBit(bitMatrix, 8, y, None));
}
@@ -130,7 +130,7 @@ pub fn ReadQRCodewords(
let mut bitsRead = 0;
let dimension = bitMatrix.height();
// Read columns in pairs, from right to left
let mut x = dimension - 1;
let mut x = (dimension as i32) - 1;
while x > 0 {
// for (int x = dimension - 1; x > 0; x -= 2) {
// Skip whole column with vertical timing pattern.
@@ -143,7 +143,7 @@ pub fn ReadQRCodewords(
let y = if readingUp { dimension - 1 - row } else { row };
for col in 0..2 {
// for (int col = 0; col < 2; col++) {
let xx = x - col;
let xx = (x - col) as u32;
// Ignore bits covered by the function pattern
if (!functionPattern.get(xx, y)) {
// Read a bit

View File

@@ -428,7 +428,7 @@ pub fn Decode(bits: &BitMatrix) -> Result<DecoderResult<bool>> {
}
// resultIterator = std::copy_n(codewordBytes.begin(), numDataCodewords, resultIterator);
resultBytes[resultIterator..numDataCodewords]
resultBytes[resultIterator..(resultIterator+numDataCodewords)]
.copy_from_slice(&codewordBytes[..numDataCodewords]);
resultIterator += numDataCodewords;
}

View File

@@ -747,8 +747,8 @@ pub fn SampleQR(image: &BitMatrix, fp: &FinderPatternSet) -> Result<QRCodeDetect
dimension as u32,
dimension as u32,
&[SamplerControl {
p0: point_i(0, dimension as u32),
p1: point_i(0, dimension as u32),
p1: point_i(dimension as u32, dimension as u32),
p0: point_i(0,0 ),
transform: mod2Pix,
}],
)?;

View File

@@ -218,12 +218,13 @@ impl<'a> Detector<'_> {
dimension: u32,
) -> Result<BitMatrix> {
let sampler = DefaultGridSampler::default();
sampler.sample_grid(
let (res, _) = sampler.sample_grid(
image,
dimension,
dimension,
&[SamplerControl::new(dimension, dimension, transform)],
)
)?;
Ok(res)
}
/**