Reputation: 101
I am confused about the coordinates in OpenCV Mat structure. When I want to get a pixel I do something like this
image.at<Vec3b>(i,j)
The question is whether (0,0) coordinate is the top-left corner coordinate. I'm not sure about that, because when I try to get (-100,-100) it still works and gets a pixel.
Upvotes: 0
Views: 710
Reputation: 1174
Yes it is the top-left.
From official documentation (for all pixel-access methods) here :
the 0-based row index (or y-coordinate) goes first and the 0-based column index (or x-coordinate) follows it
The at(-100,100)
works because it is allowed to read (fast) everywhere in memory, but the data you get is not a pixel.
Upvotes: 1