pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我在矩陣 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.

在數(shù)學(xué)中,我們有一些不同的東西:

In mathematics, we have some different things:

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


1.對于矩陣,數(shù)學(xué)符號是按行主序排列,即


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

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

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

在數(shù)學(xué)中,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.對于,選擇一個滿足兩件事的坐標(biāo)系:1.它使用相同的單位大小和相同的起源"作為矩陣符號,所以左上角是 Point(0,0) 軸長度 1 表示 1 行或 1 列的長度.2. 它使用圖像符號";對于軸排序,這意味著橫坐標(biāo)(水平軸)是指定 x 方向的第一個值,而縱坐標(biāo)(垂直軸)是指定 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.

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

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

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

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


因此,對于圖像處理來說,行優(yōu)先表示法可能很奇怪,但對于數(shù)學(xué)家來說,x 軸優(yōu)先訪問矩陣會很奇怪.


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 =)

希望這是正確的.我不太了解符號,但這是我在數(shù)學(xué)和成像方面的經(jīng)驗告訴我的.

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

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

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

相關(guān)文檔推薦

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++ 中旋轉(zhuǎn)圖像而不使用 OpenCV 函數(shù))
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 無法設(shè)置 SVM 參數(shù))
Convert a single color with cvtColor(使用 cvtColor 轉(zhuǎn)換單一顏色)
主站蜘蛛池模板: 岩棉板|岩棉复合板|聚氨酯夹芯板|岩棉夹芯板|彩钢夹芯板-江苏恒海钢结构 | 澳门精准正版免费大全,2025新澳门全年免费,新澳天天开奖免费资料大全最新,新澳2025今晚开奖资料,新澳马今天最快最新图库-首页-东莞市傲马网络科技有限公司 | 斗式提升机,斗式提升机厂家-淄博宏建机械有限公司 | 酒瓶_酒杯_玻璃瓶生产厂家_徐州明政玻璃制品有限公司 | 土壤养分检测仪|土壤水分|土壤紧实度测定仪|土壤墒情监测系统-土壤仪器网 | 微型驱动系统解决方案-深圳市兆威机电股份有限公司 | 杭州火蝠电商_京东代运营_拼多多全托管代运营【天猫代运营】 | 净气型药品柜-试剂柜-无管道净气型通风柜-苏州毕恩思 | 锌合金压铸-铝合金压铸厂-压铸模具-冷挤压-誉格精密压铸 | PVC快速门-硬质快速门-洁净室快速门品牌厂家-苏州西朗门业 | ICP备案查询_APP备案查询_小程序备案查询 - 备案巴巴 | 合金ICP光谱仪(磁性材料,工业废水)-百科| 油漆辅料厂家_阴阳脚线_艺术漆厂家_内外墙涂料施工_乳胶漆专用防霉腻子粉_轻质粉刷石膏-魔法涂涂 | 档案密集架_电动密集架_移动密集架_辽宁档案密集架-盛隆柜业厂家现货批发销售价格公道 | 浇钢砖,流钢砖_厂家价低-淄博恒森耐火材料有限公司 | 郑州律师咨询-郑州律师事务所_河南锦盾律师事务所 | 首页-恒温恒湿试验箱_恒温恒湿箱_高低温试验箱_高低温交变湿热试验箱_苏州正合 | 吹田功率计-长创耐压测试仪-深圳市新朗普电子科技有限公司 | 上海乾拓贸易有限公司-日本SMC电磁阀_德国FESTO电磁阀_德国FESTO气缸 | 飞扬动力官网-广告公司管理软件,广告公司管理系统,喷绘写真条幅制作管理软件,广告公司ERP系统 | 广州活动策划公司-15+年专业大型公关活动策划执行管理经验-睿阳广告 | 高压互感器,电流互感器,电压互感器-上海鄂互电气科技有限公司 | 宽带办理,电信宽带,移动宽带,联通宽带,电信宽带办理,移动宽带办理,联通宽带办理 | 折弯机-刨槽机-数控折弯机-数控刨槽机-数控折弯机厂家-深圳豐科机械有限公司 | 手机游戏_热门软件app下载_好玩的安卓游戏下载基地-吾爱下载站 | 石英陶瓷,石英坩埚,二氧化硅陶瓷-淄博百特高新材料有限公司 | 2-羟基泽兰内酯-乙酰蒲公英萜醇-甘草查尔酮A-上海纯优生物科技有限公司 | 搪玻璃冷凝器_厂家-越宏化工设备| 煤矿人员精确定位系统_矿用无线通信系统_煤矿广播系统 | 聚合氯化铝-碱式氯化铝-聚合硫酸铁-聚氯化铝铁生产厂家多少钱一吨-聚丙烯酰胺价格_河南浩博净水材料有限公司 | 传动滚筒_厂家-淄博海恒机械制造厂 | BESWICK球阀,BESWICK接头,BURKERT膜片阀,美国SEL继电器-东莞市广联自动化科技有限公司 | 选矿设备-新型重选设备-金属矿尾矿重选-青州冠诚重工机械有限公司 | 高压无油空压机_无油水润滑空压机_水润滑无油螺杆空压机_无油空压机厂家-科普柯超滤(广东)节能科技有限公司 | 电磁流量计厂家_涡街流量计厂家_热式气体流量计-青天伟业仪器仪表有限公司 | 粒米特测控技术(上海)有限公司-测功机_减速机测试台_电机测试台 | CTAB,表面活性剂1631溴型(十六烷基三甲基溴化铵)-上海升纬化工原料有限公司 | 航空障碍灯_高中低光强航空障碍灯_民航许可认证航空警示灯厂家-东莞市天翔航天科技有限公司 | 氨水-液氨-工业氨水-氨水生产厂家-辽宁顺程化工 | 郑州宣传片拍摄-TVC广告片拍摄-微电影短视频制作-河南优柿文化传媒有限公司 | 菏泽商标注册_菏泽版权登记_商标申请代理_菏泽商标注册去哪里 |