mitroadmaps/roadtracer

ordering of row, column in the vertices section of .graph file

Closed this issue · 5 comments

While writing out the ground truth graph as .graph file, we are ordering the vertices section as follows:

 row column

where, (row, column) is the pixel position in numpy terms with origin as the top-left corner of the image. So, a vertex with values (3, 6) will correspond to row position 3 and column position 6 from the top-left.

You do mention about the ordering in the following comment but I was still confused about which one was row/column:
#11 (comment)

Are we doing it wrong?

P.S. We have one tile per region.

I think my earlier comment is incorrect.

(0, 0) should be bottom left of imagery and it should be (column, row).

Does it mean we need to change line 97 in utils/mapextract.py to the following?

f.write('{} {}\n'.format(vertex[1], vertex[0]))

Will this be sufficient or do we also need to transform to account for the fact that bottom-left is (0,0) instead of the top-left?

Sorry. I just realized there's im = numpy.swapaxes(im, 0, 1) and the above modification is not required.

I am still not sure if any other coordinate transformation is required.

The mapextract.py is only used for roadcnn (not roadtracer), but yeah it should output graph in the expected format.

I'm not sure I understand your question. You may need to update coordinate transformation when you were writing ground truth graph file like you were asking, but after that all of the scripts in the repository should use the same format.

For interpreting the original, top-left pixel position (row, col) as a coordinate in a space where the bottom-left is the new origin, the pixel position should be transformed to (col, h - row - 1). Here h is the image height.

My question was if (col, h - row - 1) is needed or simply (col, row) would suffice.