checking, midwork

This commit is contained in:
Henry Schimke
2023-03-19 15:03:46 -05:00
parent 4c8db1f73f
commit f3af7d72a9
4 changed files with 216 additions and 18 deletions

View File

@@ -559,6 +559,33 @@ impl BitMatrix {
Some([left, top, right - left + 1, bottom - top + 1])
}
pub fn
findBoundingBox(&self, left:&mut u32, top:&mut u32, width:&mut u32, height:&mut u32, minSize:u32) -> bool
{
todo!()
// let right;
// let bottom;
// if (!self.getTopLeftOnBitWithPosition(left, top) || !self.getBottomRightOnBitWithPosition(right, bottom) || bottom - top + 1 < minSize)
// {return false;}
// for (int y = top; y <= bottom; y++ ) {
// for (int x = 0; x < left; ++x)
// if (get(x, y)) {
// left = x;
// break;
// }
// for (int x = _width-1; x > right; x--)
// if (get(x, y)) {
// right = x;
// break;
// }
// }
// width = right - left + 1;
// height = bottom - top + 1;
// return width >= minSize && height >= minSize;
}
/**
* This is useful in detecting a corner of a 'pure' barcode.
*

View File

@@ -165,20 +165,27 @@ pub trait BitMatrixCursorTrait {
fn d(&self) -> Point;
// template<typename ARRAY>
// ARRAY readPattern(int range = 0)
// {
// ARRAY res;
// for (auto& i : res)
// i = stepToEdge(1, range);
// return res;
// }
fn readPattern<T>(&self, range : Option<u32>) -> Option<T>
{
// let range = range.unwrap_or(0);
// let mut res :T;
// for i in res.into_iter() {
// i = self.stepToEdge(1, range);
// }
// // for (auto& i : res)
// // i = stepToEdge(1, range);
// return res;
todo!()
}
// template<typename ARRAY>
// ARRAY readPatternFromBlack(int maxWhitePrefix, int range = 0)
// {
// if (maxWhitePrefix && isWhite() && !stepToEdge(1, maxWhitePrefix))
// return {};
// return readPattern<ARRAY>(range);
// }
fn readPatternFromBlack<T>(&self, maxWhitePrefix:i32, range: Option<u32>) -> Option<T>
{
let range = range.unwrap_or(0);
if (maxWhitePrefix != 0 && self.isWhite() && !self.stepToEdge(Some(1), Some(maxWhitePrefix), None) > 0)
{return None;}
// return readPattern<ARRAY>(range);
self.readPattern(Some(range))
}
}