File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
QuickCode/mobile/src/main/java/com/toolslab/quickcode/model Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -177,11 +177,19 @@ private static SparseArray<Barcode> detectCodesScalingDownImageRecursively(@NonN
177177 Logger .logDebug ("Trying to detect again with a smaller image," +
178178 " this time " + smallerBitmap .getWidth () + "x" + smallerBitmap .getHeight () +
179179 " instead of " + bitmap .getWidth () + "x" + bitmap .getHeight ());
180- // Before recursive call, get rid of the original bitmap so it doesn't occupy memory
181- bitmap .recycle ();
182- return detectCodesScalingDownImageRecursively (smallerBitmap , detector );
180+
181+ bitmap .recycle (); // Before recursive call, get rid of the original bitmap so it doesn't occupy memory
182+
183+ Frame frame = new Frame .Builder ().setBitmap (smallerBitmap ).build ();
184+ SparseArray <Barcode > detectedCodes = detector .detect (frame );
185+ if (detectedCodes .size () == 0 ) {
186+ return detectCodesScalingDownImageRecursively (smallerBitmap , detector );
187+ } else {
188+ return detectedCodes ;
189+ }
183190 }
184191 }
192+ // Scaling down is not possible anymore
185193 return null ;
186194 }
187195
You can’t perform that action at this time.
0 commit comments