{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Example\n\nThe Hough transform detects straight lines in a finite set of points $p_1, \\dots, p_N$ of the plane, such as the edge pixels of an image.\nEach line is written as $x \\cos\\theta + y \\sin\\theta = \\rho$ with $\\theta \\in [0, \\pi)$ and $\\rho \\in \\R$.\nA point $p_i = (x_i, y_i)$ lies on this line exactly when $\\rho = x_i \\cos\\theta + y_i \\sin\\theta$.\nSo each point gives a sinusoidal curve in the $(\\theta, \\rho)$ plane, and the curves of collinear points meet at the parameters of their common line.\nThe transform is the count\n$$H(\\theta, \\rho) = \\#\\set{i : x_i \\cos\\theta + y_i \\sin\\theta = \\rho},$$\ncomputed in practice on a grid of cells, and lines are found as peaks of $H$.\n\nCheck on three points: $(1, 0)$, $(0, 1)$ and $(2, -1)$ lie on the line $x + y = 1$.\nFor $\\theta = \\pi/4$ and $\\rho = 1/\\sqrt{2}$, each point satisfies $x \\cos\\theta + y \\sin\\theta = (x + y)/\\sqrt{2} = 1/\\sqrt{2}$.\nSo $H(\\pi/4, 1/\\sqrt{2}) = 3$.\n\nThe [[Radon transform|VJNZJ352PC]] integrates a function along each line, and $H$ counts the given points on each line.\nSo the Hough transform is a discrete analogue of the Radon transform, applied to an edge image.\n\n## Explanations\n\n### L1 human\n\nEvery point votes for all the lines that pass through it.\nA line that passes through many points collects many votes.\nAfter the vote, the lines with the most votes are the lines in the picture.\nThe method still works when some points are missing or extra noise points are present, which makes it popular in computer vision.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "illustrates": [
      "VJNZJ352PC"
    ],
    "kind": "example",
    "msc": [
      "68U10",
      "44A12",
      "68T45"
    ],
    "name": "Hough transform",
    "same_as": {
      "wikidata": "Q195076",
      "wikipedia": "Hough transform"
    },
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Hough_transform"
      }
    ],
    "tag": "3DK4V3A10K"
  },
  "kind": "example",
  "link": "https://tamnd.github.io/math2/node/3DK4V3A10K/",
  "links": [
    {
      "field": "illustrates",
      "target": "VJNZJ352PC"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/3DK4V3A10K.md",
  "msc": [
    "68U10",
    "44A12",
    "68T45"
  ],
  "name": "Hough transform",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/3DK/3DK4V3A10K.md",
  "status": null,
  "tag": "3DK4V3A10K",
  "uri": "m2://3DK4V3A10K",
  "url": "https://tamnd.github.io/math2/wiki/hough-transform/",
  "writing": {
    "tag": "3DK4V3A10K",
    "kind": "example",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
