{
  "id": 353538,
  "title": "What's the function of rasterio.affine(1, 0, 0, 0, 1, 0)?",
  "url": "/competitions/hubmap-organ-segmentation/discussion/353538",
  "author_name": "",
  "post_date": "2022-09-18T20:47:15.936769800Z",
  "votes": 2,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I see people use this transform<br>\ndata = rasterio.open(f, transform = rasterio.Affine(1, 0, 0, 0, 1, 0))<br>\nWhat does this rasterio.affine(1, 0, 0, 0, 1, 0) do?</p>",
  "messages": [
    {
      "id": "1945103",
      "postDate": "09/18/2022 20:47:15",
      "content": "<p>I see people use this transform<br>\ndata = rasterio.open(f, transform = rasterio.Affine(1, 0, 0, 0, 1, 0))<br>\nWhat does this rasterio.affine(1, 0, 0, 0, 1, 0) do?</p>",
      "rawMarkdown": "I see people use this transform\n\ndata = rasterio.open(f, transform = rasterio.Affine(1, 0, 0, 0, 1, 0))\n\nWhat does this rasterio.affine(1, 0, 0, 0, 1, 0) do?",
      "votes": null
    },
    {
      "id": "1945628",
      "postDate": "09/19/2022 09:18:48",
      "content": "<p>It effectively does nothing - because this the the 'normal' way we show data.<br>\nAn affine transformation tells raterio how to map x and y coordinates in the source image to the final image/your screen.<br>\nThe above matrix represents:</p>\n<pre><code>1 0 0\n0 1 0\n</code></pre>\n<p>Which is the 'default' affine transformation which says each unit of 'x' represents 1 unit on the x axis, and each y represents 1 unit on the y axis. If you were to do:</p>\n<pre><code>2 0 0\n0 2 0\n</code></pre>\n<p>The image would be zoomed in by a factor of 2.</p>\n<p>Other values can rotate/flip/shear the image - see <a href=\"https://en.wikipedia.org/wiki/Affine_transformation#Image_transformation\" target=\"_blank\">https://en.wikipedia.org/wiki/Affine_transformation#Image_transformation</a></p>",
      "rawMarkdown": "It effectively does nothing - because this the the 'normal' way we show data.\nAn affine transformation tells raterio how to map x and y coordinates in the source image to the final image/your screen.\nThe above matrix represents:\n\n```\n1 0 0\n0 1 0\n```\n\nWhich is the 'default' affine transformation which says each unit of 'x' represents 1 unit on the x axis, and each y represents 1 unit on the y axis. If you were to do:\n\n```\n2 0 0\n0 2 0\n```\n\nThe image would be zoomed in by a factor of 2.\n\nOther values can rotate/flip/shear the image - see https://en.wikipedia.org/wiki/Affine_transformation#Image_transformation",
      "votes": null
    },
    {
      "id": "1946826",
      "postDate": "09/20/2022 05:56:08",
      "content": "<p>Great explanation! Thanks.</p>",
      "rawMarkdown": "Great explanation! Thanks.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1945628,
      "author_name": "jamesphoward",
      "author_url": "",
      "post_date": "09/19/2022 09:18:48",
      "content": "<p>It effectively does nothing - because this the the 'normal' way we show data.<br>\nAn affine transformation tells raterio how to map x and y coordinates in the source image to the final image/your screen.<br>\nThe above matrix represents:</p>\n<pre><code>1 0 0\n0 1 0\n</code></pre>\n<p>Which is the 'default' affine transformation which says each unit of 'x' represents 1 unit on the x axis, and each y represents 1 unit on the y axis. If you were to do:</p>\n<pre><code>2 0 0\n0 2 0\n</code></pre>\n<p>The image would be zoomed in by a factor of 2.</p>\n<p>Other values can rotate/flip/shear the image - see <a href=\"https://en.wikipedia.org/wiki/Affine_transformation#Image_transformation\" target=\"_blank\">https://en.wikipedia.org/wiki/Affine_transformation#Image_transformation</a></p>",
      "votes": null,
      "replies": [
        {
          "id": 1946826,
          "author_name": "lililycai",
          "author_url": "",
          "post_date": "09/20/2022 05:56:08",
          "content": "<p>Great explanation! Thanks.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1945103": "I see people use this transform\n\ndata = rasterio.open(f, transform = rasterio.Affine(1, 0, 0, 0, 1, 0))\n\nWhat does this rasterio.affine(1, 0, 0, 0, 1, 0) do?",
    "1945628": "It effectively does nothing - because this the the 'normal' way we show data.\nAn affine transformation tells raterio how to map x and y coordinates in the source image to the final image/your screen.\nThe above matrix represents:\n\n```\n1 0 0\n0 1 0\n```\n\nWhich is the 'default' affine transformation which says each unit of 'x' represents 1 unit on the x axis, and each y represents 1 unit on the y axis. If you were to do:\n\n```\n2 0 0\n0 2 0\n```\n\nThe image would be zoomed in by a factor of 2.\n\nOther values can rotate/flip/shear the image - see https://en.wikipedia.org/wiki/Affine_transformation#Image_transformation",
    "1946826": "Great explanation! Thanks."
  },
  "source": "meta"
}