Skip to content

Commit

Permalink
Bug fix range handling
Browse files Browse the repository at this point in the history
  • Loading branch information
danschultzer committed Jun 6, 2018
1 parent a641fb5 commit b4ec43c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/image_processor/preprocessor/opencv.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ function getPaperThreshold (im, outfile, config) {
// Find the most common color
mask.convertHSVscale()
var channels = mask.split()
var res = channels[2].meanStdDev()
var minHue = res.mean[2] - res.stddev[2] * 3
var maxHue = res.mean[2] + res.stddev[2] * 3
mask = channels[2]
mask.inRange(minHue, maxHue)
var res = channels[0].meanStdDev()
var minHue = res.mean.get(0) - res.stddev.get(0) * 3
var maxHue = res.mean.get(0) + res.stddev.get(0) * 3
mask.inRange([minHue, 0, 0], [maxHue, 260, 180])

mask = mask.threshold(10, 255, 'Binary', 'Otsu')
mask.erode(5)
mask.dilate(20)
Expand Down

0 comments on commit b4ec43c

Please sign in to comment.