diff --git a/src/shapes.js b/src/shapes.js
index af78778cd82af3878936b22549a3a0db195a1134..4941821d82726881d2ed791ffb066585a71cddfc 100644
--- a/src/shapes.js
+++ b/src/shapes.js
@@ -8,7 +8,6 @@ function sin(a) {
   return Math.sin(dtor(a))
 }
 
-const rhoStep = 5
 const angleStep = 10
 const numAngleCells = 180 / angleStep
 const rhoMax = 1000
@@ -38,14 +37,14 @@ function findMaxInHough(accum, threshold) {
   return undefined
 }
 
-function constructHoughAccumulator(accumulator, x, y) {
+function constructHoughAccumulator(config, accumulator, x, y) {
   for (let thetaIndex = 0; thetaIndex < numAngleCells; thetaIndex++) {
     const theta = thetaIndex * angleStep
     let rho = x * cos(theta) + y * sin(theta)
     rho = Math.floor(rho)
     rho += rhoMax
     rho >>= 1
-    rho /= rhoStep
+    rho /= config.rhoStep
     rho = Math.floor(rho)
     if (accumulator[thetaIndex] == undefined) accumulator[thetaIndex] = []
     if (accumulator[thetaIndex][rho] == undefined) {
@@ -150,7 +149,10 @@ function recognizeRect(points) {
 function recognizeLine(points) {
   if (!(points && points.length)) return {}
   const accum = Array(numAngleCells)
-  points.forEach((x) => constructHoughAccumulator(accum, ...x))
+  const houghConfig = {
+    rhoStep: points.length > 100 ? 50 : 5,
+  }
+  points.forEach((x) => constructHoughAccumulator(houghConfig, accum, ...x))
   const angle = findMaxInHough(accum, points.length - 1)
 
   if (angle !== undefined) {