Skip to content

Commit

Permalink
Merge of PR cozmo#148: Fix "onlyInvert" inversionAttempts option
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit e7f282a
Author: LakeGH <[email protected]>
Date:   Thu Nov 14 13:29:15 2019 -0500

    Removing unneeded whitespace.

commit 13843e5
Author: LakeGH <[email protected]>
Date:   Thu Nov 14 13:14:50 2019 -0500

    Remove trailing whitespace for tslint

commit 4f3fef8
Author: LakeGH <[email protected]>
Date:   Thu Nov 14 13:12:12 2019 -0500

    Change order of inversionAttempts check for tslint

commit 0dfc578
Author: LakeGH <[email protected]>
Date:   Thu Nov 14 12:55:55 2019 -0500

    Fix "onlyInvert" inversionAttempts option.

    `shouldInvert` should also be true if `options.inversionAttempts` equals "onlyInvert".
  • Loading branch information
danimoh committed Jul 9, 2020
1 parent 355a7ba commit 79fbb28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ function jsQR(data: Uint8ClampedArray, width: number, height: number, providedOp
mergeObject(options, defaultOptions);
mergeObject(options, providedOptions);

const shouldInvert = options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst";
const tryInvertedFirst = options.inversionAttempts === "onlyInvert" || options.inversionAttempts === "invertFirst";
const shouldInvert = options.inversionAttempts === "attemptBoth" || tryInvertedFirst;
const {binarized, inverted} = binarize(data, width, height, shouldInvert, options.greyScaleWeights,
options.canOverwriteImage);
let result = scan(tryInvertedFirst ? inverted : binarized);
Expand Down

0 comments on commit 79fbb28

Please sign in to comment.