久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

OpenCV Point(x,y) 表示 (column,row) 或 (row,column)

OpenCV Point(x,y) represent (column,row) or (row,column)(OpenCV Point(x,y) 表示 (column,row) 或 (row,column))
本文介紹了OpenCV Point(x,y) 表示 (column,row) 或 (row,column)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在矩陣 src 中有一個 300x200 的圖像.我正在對圖像進行以下操作.

I have a 300x200 image in a Matrix src. I am doing the following operation on the image.

for(int i=0;i<src.rows;i++){
  for(int j=0;j<src.cols;j++){
    line( src, Point(i,j),Point(i,j), Scalar( 255, 0, 0 ),  1,8 );
  }
}
imshow("A",src);
waitKey(0);

我希望它以白色覆蓋整個圖像,但圖像的下部仍然是空的.而如果我這樣做

I was expecting it to cover the entire image in white, but lower portion of the image remain empty. While if I do this

  for(int i=0;i<src.rows;i++){
    for(int j=0;j<src.cols;j++){
      src.at<uchar>(i,j)=255;
    }
  }
  imshow("A",src);
  waitKey(0);

整個圖像被白色覆蓋.所以,這意味著 src.at(i,j) 使用 (i,j) 作為 (row,column) 但 Point(x,y) 使用 (x,y) 作為 (column,row)

Entire image is covered in white. So, this means that src.at<uchar>(i,j) is using (i,j) as (row,column) but Point(x,y) is using (x,y) as (column,row)

推薦答案

所以,這意味著 src.at(i,j) 使用 (i,j) 作為 (row,column) 但 Point(x,y) 使用 (x,y) 作為 (column,row)

So, this means that src.at(i,j) is using (i,j) as (row,column) but Point(x,y) is using (x,y) as (column,row)

沒錯!因為這似乎讓很多人感到困惑,所以我將寫下我的解釋:

That is right! Since this seems to confuse many people I'll write my interpretation for the reason:

在 OpenCV 中,cv::Mat 用于圖像和矩陣,因為離散圖像與矩陣基本相同.

In OpenCV, cv::Mat is used for both, images and matrices, since a discrete image is basically the same as a matrix.

在數學中,我們有一些不同的東西:

In mathematics, we have some different things:

  1. 矩陣,具有多行多列.
  2. (函數的)圖形,具有多個軸并以圖像的形式以圖形方式表示圖形.
  3. 點,按坐標系的軸排序,坐標系通常是笛卡爾坐標.


1.對于矩陣,數學符號是按行主序排列,即


1. For matrices, the mathematical notation is to order in row-major-order which is

按照傳統的矩陣表示法,行按二維數組的第一個索引編號,列按第二個索引編號,即 a1,2 是第一行的第二個元素,向下和向右計數.(請注意,這與笛卡爾約定相反.)

Following conventional matrix notation, rows are numbered by the first index of a two-dimensional array and columns by the second index, i.e., a1,2 is the second element of the first row, counting downwards and rightwards. (Note this is the opposite of Cartesian conventions.)

取自 http://en.wikipedia.org/wiki/Row-major_order#說明_and_example

在數學中,row:0, column:0 是矩陣的左上角元素.行/列就像在表格中...

As in mathematics, row:0, column:0 is the top-left element of the matrix. Row/column are just like in tables...

0/0---column--->
 |
 |
row
 |
 |
 v


2.對于,選擇一個滿足兩件事的坐標系:1.它使用相同的單位大小和相同的起源"作為矩陣符號,所以左上角是 Point(0,0) 軸長度 1 表示 1 行或 1 列的長度.2. 它使用圖像符號";對于軸排序,這意味著橫坐標(水平軸)是指定 x 方向的第一個值,而縱坐標(垂直軸)是指定 y 方向的第二個值.


2. For Points, a coordinate system is chosen that fulfills two things: 1. it uses the same unit-sizes and the same "origin" as the matrix notation, so top-left is Point(0,0) and axis length 1 means the length of 1 row or 1 column. 2. it uses "image notation" for axis-ordering, which means that abscissa (horizontal axis) is the first value designating the x-direction and the ordinate (vertical axis) is the second value designating the y-direction.

軸線相交的點是兩條數軸的共同原點,簡稱原點.它通常標記為 O,如果是,則軸稱為 Ox 和 Oy.定義了 x 軸和 y 軸的平面通常稱為笛卡爾平面或 xy 平面.x 的值稱為 x 坐標或橫坐標,y 的值稱為 y 坐標或縱坐標.

The point where the axes meet is the common origin of the two number lines and is simply called the origin. It is often labeled O and if so then the axes are called Ox and Oy. A plane with x- and y-axes defined is often referred to as the Cartesian plane or xy plane. The value of x is called the x-coordinate or abscissa and the value of y is called the y-coordinate or ordinate.

字母的選擇來源于原來的約定,就是用字母的后半部分來表示未知的值.字母表的第一部分用于指定已知值.

The choices of letters come from the original convention, which is to use the latter part of the alphabet to indicate unknown values. The first part of the alphabet was used to designate known values.

http://en.wikipedia.org/wiki/Cartesian_coordinate_system#Two_dimensions

所以在一個完美的世界中,我們會選擇點/圖像的坐標系:

so in a perfect world, we would choose the coordinate system of points/images to be:

 ^
 |
 |
 Y
 |
 |
0/0---X--->

但由于我們希望在左上角的原點和正值到達底部,所以改為:

but since we want to have that origin in top-left and positive values to go to the bottom, it is instead:

0/0---X--->
 |
 |
 Y
 |
 |
 v


因此,對于圖像處理來說,行優先表示法可能很奇怪,但對于數學家來說,x 軸優先訪問矩陣會很奇怪.


So, for image processing people row-first notation might be weird, but for mathematicians x-axis-first would be strange to access a matrix.

因此,在 OpenCV 中,您可以使用:mat.at(row,column)mat.at(cv::Point(x,y)) 訪問同一點,如果 x=columny=row 這是完全可以理解的 =)

So, in OpenCV, you can use: mat.at<type>(row,column) or mat.at<type>(cv::Point(x,y)) to access the same point if x=column and y=row which is perfectly comprehensible =)

希望這是正確的.我不太了解符號,但這是我在數學和成像方面的經驗告訴我的.

Hope this correct. I don't know much about the notations, but that's what my experience in mathematics and imaging tells me.

這篇關于OpenCV Point(x,y) 表示 (column,row) 或 (row,column)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Assertion failed (size.widthgt;0 amp;amp; size.heightgt;0)(斷言失敗(size.width0 amp;amp; size.height0))
Rotate an image in C++ without using OpenCV functions(在 C++ 中旋轉圖像而不使用 OpenCV 函數)
OpenCV: process every frame(OpenCV:處理每一幀)
Why can#39;t I open avi video in openCV?(為什么我不能在 openCV 中打開 avi 視頻?)
OpenCV unable to set up SVM Parameters(OpenCV 無法設置 SVM 參數)
Convert a single color with cvtColor(使用 cvtColor 轉換單一顏色)
主站蜘蛛池模板: 四虎成人在线播放 | 久久网站免费视频 | 九九色综合| 成人黄色在线 | 欧美一区二区在线 | 好姑娘影视在线观看高清 | 蜜桃色网 | 91精品国产91久久久久游泳池 | 日本一二三区在线观看 | 中文字幕在线不卡 | 国产精品美女久久久久久免费 | 日韩中文在线视频 | 亚洲日本欧美日韩高观看 | 激情欧美一区二区三区 | 久久人人爽人人爽 | 日本不卡一区二区三区 | 久久综合久久综合久久综合 | 日本一区二区三区免费观看 | 欧美精品一区在线发布 | 日韩精品一区二区三区老鸭窝 | 精品亚洲永久免费精品 | 成人深夜福利在线观看 | 先锋影音资源网站 | 欧美日韩在线观看一区二区三区 | 久久久美女 | 激情一区| 日韩av手机在线观看 | 日韩欧美精品一区 | 亚洲国产精品一区在线观看 | 黄色片在线 | 97国产一区二区精品久久呦 | 欧美日韩一区二区三区四区 | 特黄小视频 | 亚洲一区二区三区免费 | www.亚洲 | 久热国产在线 | 美女福利视频 | 午夜一区二区三区在线观看 | 日日夜夜精品免费视频 | 一区二区三区免费 | 久久久精品网站 |