{
  "id": 375157,
  "title": "Weird interpolation artifacts",
  "url": "/competitions/rsna-breast-cancer-detection/discussion/375157",
  "author_name": "Gunes Evitan",
  "post_date": "2022-12-30T15:49:54.025000",
  "votes": 4,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I was casting images to 8-bit then resizing them using bicubic interpolation and writing them to disk. I changed my pipeline to cast to float -&gt; resize -&gt; cast to 8-bit -&gt; write, but I noticed those weird artifacts. They are gone after I changed interpolation to bilinear interpolation or resize 8-bit image. Why do they occur tho?</p>\n<p><img src=\"https://i.ibb.co/1Z4YMpp/1.png\" alt=\"i\"></p>",
  "messages": [
    {
      "id": 2080906,
      "postDate": "2022-12-30T15:49:54.027Z",
      "content": "<p>I was casting images to 8-bit then resizing them using bicubic interpolation and writing them to disk. I changed my pipeline to cast to float -&gt; resize -&gt; cast to 8-bit -&gt; write, but I noticed those weird artifacts. They are gone after I changed interpolation to bilinear interpolation or resize 8-bit image. Why do they occur tho?</p>\n<p><img src=\"https://i.ibb.co/1Z4YMpp/1.png\" alt=\"i\"></p>",
      "rawMarkdown": "I was casting images to 8-bit then resizing them using bicubic interpolation and writing them to disk. I changed my pipeline to cast to float -> resize -> cast to 8-bit -> write, but I noticed those weird artifacts. They are gone after I changed interpolation to bilinear interpolation or resize 8-bit image. Why do they occur tho?\n\n![i](https://i.ibb.co/1Z4YMpp/1.png)",
      "votes": 4
    },
    {
      "id": 2080927,
      "postDate": "2022-12-30T16:16:44.533Z",
      "content": "<p>I suspect the explanation is related to bicubic interpolation's tendency to 'overshoot', where you can end up with values outside of 0-255 if the change in brightness is extreme, which is where your white spots are (going from bright to dark). I suspect your dark pixels have gone below 0 and wrapped into bright space again.</p>\n<p>If you are doing your interpolation in float space, then maybe try clipping your values between 0 and 1 after interpolation, before recasting?</p>",
      "rawMarkdown": "I suspect the explanation is related to bicubic interpolation's tendency to 'overshoot', where you can end up with values outside of 0-255 if the change in brightness is extreme, which is where your white spots are (going from bright to dark). I suspect your dark pixels have gone below 0 and wrapped into bright space again.\n\nIf you are doing your interpolation in float space, then maybe try clipping your values between 0 and 1 after interpolation, before recasting?",
      "votes": 1,
      "replies": [
        {
          "id": 2080960,
          "postDate": "2022-12-30T16:39:58.683Z",
          "content": "<p>I see… That makes so much sense since they always occur on boundaries of breast.</p>",
          "rawMarkdown": "I see... That makes so much sense since they always occur on boundaries of breast."
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2080927,
      "author_name": "James Howard",
      "author_url": "",
      "post_date": "2022-12-30T16:16:44.533000",
      "content": "<p>I suspect the explanation is related to bicubic interpolation's tendency to 'overshoot', where you can end up with values outside of 0-255 if the change in brightness is extreme, which is where your white spots are (going from bright to dark). I suspect your dark pixels have gone below 0 and wrapped into bright space again.</p>\n<p>If you are doing your interpolation in float space, then maybe try clipping your values between 0 and 1 after interpolation, before recasting?</p>",
      "votes": 1,
      "replies": [
        {
          "id": 2080960,
          "author_name": "Gunes Evitan",
          "author_url": "",
          "post_date": "2022-12-30T16:39:58.683000",
          "content": "<p>I see… That makes so much sense since they always occur on boundaries of breast.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2080906": "I was casting images to 8-bit then resizing them using bicubic interpolation and writing them to disk. I changed my pipeline to cast to float -> resize -> cast to 8-bit -> write, but I noticed those weird artifacts. They are gone after I changed interpolation to bilinear interpolation or resize 8-bit image. Why do they occur tho?\n\n![i](https://i.ibb.co/1Z4YMpp/1.png)",
    "2080927": "I suspect the explanation is related to bicubic interpolation's tendency to 'overshoot', where you can end up with values outside of 0-255 if the change in brightness is extreme, which is where your white spots are (going from bright to dark). I suspect your dark pixels have gone below 0 and wrapped into bright space again.\n\nIf you are doing your interpolation in float space, then maybe try clipping your values between 0 and 1 after interpolation, before recasting?"
  }
}