{
  "id": 27130,
  "title": "Understanding geometry/pixel coordinates relationship",
  "url": "/competitions/dstl-satellite-imagery-feature-detection/discussion/27130",
  "author_name": "",
  "post_date": "2016-12-30T20:53:32.597Z",
  "votes": 7,
  "comment_count": 3,
  "views": 504,
  "content": "<p>Hi,</p>\n\n<p>The coordinates of the multi-polygons are a series of numbers between 0 and 1 (for x axis) and -1 and 0 (for y axis).  If I had a coordinate x,y from an image with width W and height H, common sense would seem to be that to get the pixel coordinate I just do</p>\n\n<p>x' = x*W</p>\n\n<p>y' = y*H.</p>\n\n<p>This is much simpler than the equations given in the competition docs. The docs give the extra step </p>\n\n<p>W' = W*W/(W+1)</p>\n\n<p>H' = H*H/(H+1)</p>\n\n<p>Any ideas why this slight correction is needed? Also having the x_max and y_min values stored in a separate file makes me that someone couldn't be bothered to just normalize the data before posting it. (Giving the data ranges as [0,1] and [-1,0] makes it seem as if someone had normalized the values.)</p>\n\n<p>In a way doesn't matter - but would feel better being sure that I haven't overlooked something obvious.</p>\n\n<p>Thanks, Greg</p>",
  "messages": [
    {
      "id": "153290",
      "postDate": "12/30/2016 20:53:32",
      "content": "<p>Hi,</p>\n\n<p>The coordinates of the multi-polygons are a series of numbers between 0 and 1 (for x axis) and -1 and 0 (for y axis).  If I had a coordinate x,y from an image with width W and height H, common sense would seem to be that to get the pixel coordinate I just do</p>\n\n<p>x' = x*W</p>\n\n<p>y' = y*H.</p>\n\n<p>This is much simpler than the equations given in the competition docs. The docs give the extra step </p>\n\n<p>W' = W*W/(W+1)</p>\n\n<p>H' = H*H/(H+1)</p>\n\n<p>Any ideas why this slight correction is needed? Also having the x_max and y_min values stored in a separate file makes me that someone couldn't be bothered to just normalize the data before posting it. (Giving the data ranges as [0,1] and [-1,0] makes it seem as if someone had normalized the values.)</p>\n\n<p>In a way doesn't matter - but would feel better being sure that I haven't overlooked something obvious.</p>\n\n<p>Thanks, Greg</p>",
      "rawMarkdown": "Hi,\r\n\r\nThe coordinates of the multi-polygons are a series of numbers between 0 and 1 (for x axis) and -1 and 0 (for y axis).  If I had a coordinate x,y from an image with width W and height H, common sense would seem to be that to get the pixel coordinate I just do\r\n\r\nx' = x*W\r\n\r\ny' = y*H.\r\n\r\nThis is much simpler than the equations given in the competition docs. The docs give the extra step \r\n\r\nW' = W*W/(W+1)\r\n\r\nH' = H*H/(H+1)\r\n\r\nAny ideas why this slight correction is needed? Also having the x_max and y_min values stored in a separate file makes me that someone couldn't be bothered to just normalize the data before posting it. (Giving the data ranges as [0,1] and [-1,0] makes it seem as if someone had normalized the values.)\r\n\r\nIn a way doesn't matter - but would feel better being sure that I haven't overlooked something obvious.\r\n\r\nThanks, Greg",
      "votes": null
    },
    {
      "id": "154682",
      "postDate": "01/07/2017 16:14:44",
      "content": "<p>It looks like this is to keep the transformed coordinates <em>strictly</em> within the boundaries of the (W, H) rectangle, but I don't know how this would matter either. Would it make plotting more difficult if a polygon had a coordinate on the boundary of the image?</p>\n\n<p>The only other thing I can think of is the zero-based indexing, since x = xmax would correspond to an integer index of W - 1 instead of W.</p>",
      "rawMarkdown": "It looks like this is to keep the transformed coordinates *strictly* within the boundaries of the (W, H) rectangle, but I don't know how this would matter either. Would it make plotting more difficult if a polygon had a coordinate on the boundary of the image?\r\n\r\nThe only other thing I can think of is the zero-based indexing, since x = xmax would correspond to an integer index of W - 1 instead of W.",
      "votes": null
    },
    {
      "id": "157491",
      "postDate": "01/21/2017 15:27:42",
      "content": "<p>@Greg maybe your suggested multiplier is better.</p>\n\n<p>If W = 100 and xmax = 1, we need a mapping from the continuous interval [0, 1] to the discrete set of values 0, 1, ..., 99. The given multiplier to scale x up to the discrete grid scale is  (1 / xmax) * W' where W' = W * W / (W  +1) . With the aforementioned values, this multiplier is 99.</p>\n\n<p>Since x ranges from 0 to 1, x times the multiplier ranges from 0 to 99. Sounds reasonable on the surface, but if you map [0, 1] to {0}, (1, 2] to {1}, and so on, eventually you get (98, 99] mapped to {98}, which leaves out {99}.</p>",
      "rawMarkdown": "Greg maybe your suggested multiplier is better.\r\n\r\n If W = 100 and xmax = 1, we need a mapping from the continuous interval [0, 1] to the discrete set of values 0, 1, ..., 99. The given multiplier to scale x up to the discrete grid scale is  (1 / xmax) * W' where W' = W * W / (W  +1) . With the aforementioned values, this multiplier is 99.\r\n\r\nSince x ranges from 0 to 1, x times the multiplier ranges from 0 to 99. Sounds reasonable on the surface, but if you map [0, 1] to {0}, (1, 2] to {1}, and so on, eventually you get (98, 99] mapped to {98}, which leaves out {99}.",
      "votes": null
    },
    {
      "id": "157504",
      "postDate": "01/21/2017 17:30:15",
      "content": "<p>But the weird thing is that the formula they have given us does not give a multiplier of 99. It gives W' =99.0099009901. The obvious correct formula is W'=W-1</p>",
      "rawMarkdown": "But the weird thing is that the formula they have given us does not give a multiplier of 99. It gives W' =99.0099009901. The obvious correct formula is W'=W-1",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 154682,
      "author_name": "baogorek",
      "author_url": "",
      "post_date": "01/07/2017 16:14:44",
      "content": "<p>It looks like this is to keep the transformed coordinates <em>strictly</em> within the boundaries of the (W, H) rectangle, but I don't know how this would matter either. Would it make plotting more difficult if a polygon had a coordinate on the boundary of the image?</p>\n\n<p>The only other thing I can think of is the zero-based indexing, since x = xmax would correspond to an integer index of W - 1 instead of W.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 157491,
      "author_name": "baogorek",
      "author_url": "",
      "post_date": "01/21/2017 15:27:42",
      "content": "<p>@Greg maybe your suggested multiplier is better.</p>\n\n<p>If W = 100 and xmax = 1, we need a mapping from the continuous interval [0, 1] to the discrete set of values 0, 1, ..., 99. The given multiplier to scale x up to the discrete grid scale is  (1 / xmax) * W' where W' = W * W / (W  +1) . With the aforementioned values, this multiplier is 99.</p>\n\n<p>Since x ranges from 0 to 1, x times the multiplier ranges from 0 to 99. Sounds reasonable on the surface, but if you map [0, 1] to {0}, (1, 2] to {1}, and so on, eventually you get (98, 99] mapped to {98}, which leaves out {99}.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 157504,
      "author_name": "threeplusone",
      "author_url": "",
      "post_date": "01/21/2017 17:30:15",
      "content": "<p>But the weird thing is that the formula they have given us does not give a multiplier of 99. It gives W' =99.0099009901. The obvious correct formula is W'=W-1</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "153290": "Hi,\r\n\r\nThe coordinates of the multi-polygons are a series of numbers between 0 and 1 (for x axis) and -1 and 0 (for y axis).  If I had a coordinate x,y from an image with width W and height H, common sense would seem to be that to get the pixel coordinate I just do\r\n\r\nx' = x*W\r\n\r\ny' = y*H.\r\n\r\nThis is much simpler than the equations given in the competition docs. The docs give the extra step \r\n\r\nW' = W*W/(W+1)\r\n\r\nH' = H*H/(H+1)\r\n\r\nAny ideas why this slight correction is needed? Also having the x_max and y_min values stored in a separate file makes me that someone couldn't be bothered to just normalize the data before posting it. (Giving the data ranges as [0,1] and [-1,0] makes it seem as if someone had normalized the values.)\r\n\r\nIn a way doesn't matter - but would feel better being sure that I haven't overlooked something obvious.\r\n\r\nThanks, Greg",
    "154682": "It looks like this is to keep the transformed coordinates *strictly* within the boundaries of the (W, H) rectangle, but I don't know how this would matter either. Would it make plotting more difficult if a polygon had a coordinate on the boundary of the image?\r\n\r\nThe only other thing I can think of is the zero-based indexing, since x = xmax would correspond to an integer index of W - 1 instead of W.",
    "157491": "Greg maybe your suggested multiplier is better.\r\n\r\n If W = 100 and xmax = 1, we need a mapping from the continuous interval [0, 1] to the discrete set of values 0, 1, ..., 99. The given multiplier to scale x up to the discrete grid scale is  (1 / xmax) * W' where W' = W * W / (W  +1) . With the aforementioned values, this multiplier is 99.\r\n\r\nSince x ranges from 0 to 1, x times the multiplier ranges from 0 to 99. Sounds reasonable on the surface, but if you map [0, 1] to {0}, (1, 2] to {1}, and so on, eventually you get (98, 99] mapped to {98}, which leaves out {99}.",
    "157504": "But the weird thing is that the formula they have given us does not give a multiplier of 99. It gives W' =99.0099009901. The obvious correct formula is W'=W-1"
  },
  "source": "meta"
}