maxicode detector should return found rotation

This commit is contained in:
Henry Schimke
2023-02-01 13:51:22 -06:00
parent e2b79819e6
commit 9e8606baef
2 changed files with 49 additions and 16 deletions

View File

@@ -68,8 +68,11 @@ impl Reader for MaxiCodeReader {
Some(DecodeHintValue::TryHarder(true))
);
let mut rotation = None;
let decoderRXingResult = if try_harder {
let result = detector::detect(image.getBlackMatrixMut(), try_harder)?;
rotation = Some(result.rotation());
let parsed_result = detector::read_bits(result.getBits())?;
maxicode_decoder::decode_with_hints(&parsed_result, hints)?
} else {
@@ -93,6 +96,16 @@ impl Reader for MaxiCodeReader {
crate::RXingResultMetadataValue::ErrorCorrectionLevel(ecLevel.to_owned()),
);
}
if let Some(rot) = rotation {
if rot > 0.0 {
result.putMetadata(
RXingResultMetadataType::ORIENTATION,
crate::RXingResultMetadataValue::Orientation(rot as i32),
)
}
}
Ok(result)
}