liif icon indicating copy to clipboard operation
liif copied to clipboard

Regarding the code in liif.py

Open Swaraj-72 opened this issue 4 years ago • 3 comments
trafficstars

Hi, I have found it difficult to understand the purpose of rx, ry in the code below. Kindly let me know the same. Also why should we perform the flip operation (coord_.flip(-1)) on the "coord_" variable when we have received the actual coordinates.Thank you. Issue

Swaraj-72 avatar Jul 13 '21 14:07 Swaraj-72

The coordinates of all centers are a constraint, by default, within [-1, 1]. This means the length of the side of each grid is [1 - (-1)]/N = 2/N where N is the number of grids in each direction. Thus, the shortest distance between the center of each grid to its border (radius, r) = (2/N)/2 = 2 / N / 2

Surayuth avatar Nov 03 '21 19:11 Surayuth

I believe flip is required for properly indexing x and y coordinates. The documentation for grid_sample() states that,

...the size-2 vector grid[n, h, w] specifies input pixel locations x and y... .

As the coord variable is basically a meshgride in (y, x) coordinate format (here), flip is required.

codeslake avatar Aug 09 '22 15:08 codeslake

For later readers, note that in grid_sample(), the x-axis is along the width of an image and the y-axis is along its height.

I believe flip is required for properly indexing x and y coordinates. The documentation for grid_sample() states that,

...the size-2 vector grid[n, h, w] specifies input pixel locations x and y... .

As the coord variable is basically a meshgride in (y, x) coordinate format (here), flip is required.

axhiao avatar Sep 07 '22 02:09 axhiao