Skip to content

Commit

Permalink
Enable Micro QR code detection in iOS app
Browse files Browse the repository at this point in the history
Summary: see title

Reviewed By: enpe

Differential Revision:
D63850341

Privacy Context Container: L1191897

fbshipit-source-id: 0ddd0e77ced9df6ef0a74eefe7bd0c4c76c1b295
  • Loading branch information
thorntondr authored and facebook-github-bot committed Oct 4, 2024
1 parent a02bfd6 commit eaa2419
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
std::vector<std::wstring> commandLines;
commandLines.push_back(L"LiveVideoId:0"); // 0. Video source
commandLines.push_back(L"1280x720"); // 1. Video resolution
commandLines.push_back(L"--micro"); // 2. Include micro QR codes

detectorWrapper_ = Detector2DWrapper(commandLines);

Expand Down
5 changes: 3 additions & 2 deletions impl/ocean/cv/detector/qrcodes/MicroQRCodeDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool MicroQRCodeDetector::getTimingPatternModules(const uint8_t* const yFrame, c
Bresenham bresenhamBack(xBack, yBack, Numeric::round32(farPointBack.x()), Numeric::round32(farPointBack.y()));

VectorT2<unsigned int> lastIn, firstOut;
if(TransitionDetector::findNextPixel<true>(yFrame, xBack, yBack, width, height, paddingElements, bresenhamBack, maxStepSize, finderPattern.grayThreshold(), columns, rows, lastIn, firstOut))
if(xBack < width && yBack < height && TransitionDetector::findNextPixel<true>(yFrame, xBack, yBack, width, height, paddingElements, bresenhamBack, maxStepSize, finderPattern.grayThreshold(), columns, rows, lastIn, firstOut))
{
// Found dark pixel in quiet zone
return false;
Expand Down Expand Up @@ -96,7 +96,8 @@ bool MicroQRCodeDetector::getTimingPatternModules(const uint8_t* const yFrame, c
bool foundDark = true;
for (bool start : {true, false})
{
if ((start && !TransitionDetector::findNextPixel<true>(yFrame, x, y, width, height, paddingElements, bresenham, maxStepSize, finderPattern.grayThreshold(), columns, rows, lastIn, firstOut))
if ( x >= width || y >= height
|| (start && !TransitionDetector::findNextPixel<true>(yFrame, x, y, width, height, paddingElements, bresenham, maxStepSize, finderPattern.grayThreshold(), columns, rows, lastIn, firstOut))
|| (!start && !TransitionDetector::findNextPixel<false>(yFrame, x, y, width, height, paddingElements, bresenham, maxStepSize, finderPattern.grayThreshold(), columns, rows, lastIn, firstOut)))
{
foundDark = false;
Expand Down

0 comments on commit eaa2419

Please sign in to comment.