mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
slight performance improvement, detector
This commit is contained in:
@@ -77,7 +77,7 @@ impl Reader for DataMatrixReader {
|
||||
decoderRXingResult = DECODER.decode(&bits)?;
|
||||
points.clear();
|
||||
} else {
|
||||
let detectorRXingResult = Detector::new(image.getBlackMatrix().clone())?.detect()?;
|
||||
let detectorRXingResult = Detector::new(image.getBlackMatrix())?.detect()?;
|
||||
decoderRXingResult = DECODER.decode(detectorRXingResult.getBits())?;
|
||||
points = detectorRXingResult.getPoints().clone();
|
||||
}
|
||||
|
||||
@@ -27,14 +27,14 @@ use super::DatamatrixDetectorResult;
|
||||
*
|
||||
* @author Sean Owen
|
||||
*/
|
||||
pub struct Detector {
|
||||
image: BitMatrix,
|
||||
pub struct Detector<'a> {
|
||||
image: &'a BitMatrix,
|
||||
rectangleDetector: WhiteRectangleDetector,
|
||||
}
|
||||
impl Detector {
|
||||
pub fn new(image: BitMatrix) -> Result<Self, Exceptions> {
|
||||
Ok(Self {
|
||||
rectangleDetector: WhiteRectangleDetector::new_from_image(&image)?,
|
||||
impl<'a> Detector<'_> {
|
||||
pub fn new(image: &'a BitMatrix) -> Result<Detector<'a>, Exceptions> {
|
||||
Ok(Detector {
|
||||
rectangleDetector: WhiteRectangleDetector::new_from_image(image)?,
|
||||
image,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user