question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(row, column) or (column, row) ?

See original GitHub issue

I am new to this, so this question may sound dumb.

As far as what I know, here are some different notations for a point (1, 100)

0/0---column--->
 |   --------------**.** (1,100)
 |
row
 |
 |
 v
(matrix)

0/0---X--->
 |
 |
 Y
 |
 | **.** (1,100)
 v
 (opencv and plt)

So if I use my custom dataset, I believe I should go with the matrix one and do “xmin, ymin, xmas, ymax”, since all the internal operations are on matrices. But in keras-retinanet/examples/ResNet50RetinaNet - COCO 2017.ipynb, I see cv2.rectangle(draw, (b[0], b[1]), (b[2], b[3]), ... for both detections and annotations. Aren’t those inverted (should be (b[1], b[0]), (b[3], b[2])?), or is there anything I missed?

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
hgaisercommented, Dec 22, 2017

Yeah that’s right. All image coordinates and boxes follow the (xmin, ymin, xmax, ymax).

1reaction
de-vri-escommented, Dec 22, 2017

“xmin, ymin, xmas, ymax”

I see what you did there 😉

Anyway, for numpy matrices you’re right that the first coordinate is the row index. In an image however, we say that the X axis points to the right and the Y axis points down. I’ve never seen a different convention. This doesn’t match with each other, but opencv deals with the difference internally.

Long story short: when specifying an opencv point or rectangle, you should use image coordinates, not matrix indices.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Columns vs rows: What's the difference? - TheServerSide.com
The key difference between columns and rows is that a column arranges data vertically from top to bottom, while a row arranges data...
Read more >
Is it "rows by columns" or "columns by rows"? - Cross Validated
"That depends." Rows are usually considered observations, and columns are variables. So I would say widgets by color level in your context.
Read more >
Describing Matrices (Rows and Columns)
The basics of a matrix. Looking at rows, columns, elements and dimension. A matrix is a rectangular arrangement composed of row, columns and...
Read more >
Row vs Column – Difference Between Them - Guru99
A row is a series of data put out horizontally in a table or spreadsheet, while a column is a vertical series of...
Read more >
Row- and column-major order - Wikipedia
In computing, row-major order and column-major order are methods for storing multidimensional arrays in linear storage such as random access memory.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found