简体   繁体   English

打开CV Mat结构坐标

[英]Open CV Mat structure coordinates

I am confused about the coordinates in OpenCV Mat structure. 我对OpenCV Mat结构中的坐标感到困惑。 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. 问题是(0,0)坐标是否为左上角坐标。 I'm not sure about that, because when I try to get (-100,-100) it still works and gets a pixel. 我不确定,因为当我尝试获得(-100,-100)时,它仍然可以工作并获得像素。

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 从0开始的行索引(或y坐标)排在最前面,从0开始的列索引(或x坐标)在其后

The at(-100,100) works because it is allowed to read (fast) everywhere in memory, but the data you get is not a pixel. at(-100,100)之所以起作用,是因为可以在内存中的任何地方读取(快速),但是您获得的数据不是像素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM