<h1 style="font-size: 32px; font-weight: bold; border-bottom: 2px solid rgb(204, 204, 204); padding: 0px 4px 0px 0px; text-align: left; margin: 0px 0px 10px;"><span style="color: rgb(51, 51, 51); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 33.6px; ">OpenCV 常用函数与构造体详细说明</span></h1><p></p><p style="background:rgb(0,176,80)"><strong><span style="font-family: 宋体;font-size: 20px"><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">成员函数</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">成员函数如下:</span></span></p><table border="1" style="border-right: none; border-bottom: none; border-image: initial; border-left: 1px solid rgb(102, 102, 102); border-top: 1px solid rgb(102, 102, 102);"><tbody><tr class="firstRow"><td width="48" valign="top" style="border-width: 1px; border-color: windowtext rgb(102, 102, 102) rgb(102, 102, 102) windowtext; border-bottom-style: solid; border-right-style: solid; padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px">序号</span></p></td><td width="117" valign="top" style="border-width: 1px; border-color: windowtext rgb(102, 102, 102) rgb(102, 102, 102) windowtext; border-bottom-style: solid; border-right-style: solid; padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px">成员函数</span></p></td><td width="403" valign="top" style="border-width: 1px; border-color: windowtext rgb(102, 102, 102) rgb(102, 102, 102) windowtext; border-bottom-style: solid; border-right-style: solid; padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px">功能</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">1 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">addref</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family: Arial;color: rgb(54, 46, 43);letter-spacing: 0;font-size: 14px;background: rgb(255, 255, 255)"><span style="font-family:宋体">计数器参考</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">2 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">adjustROI</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">调整子阵大小及其在父矩阵中的位置</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">3 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">assignTo</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">提供了一个</span><span style="font-family:Calibri">convertTo</span><span style="font-family:宋体">的功能形式</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">4 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">at</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回对指定数组元素的引用</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">5 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">begin</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回矩阵迭代器,并将其设置为第一矩阵元</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">6 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">channels</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回矩阵通道的数目</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">7 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">checkVector</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">矩阵如果其深度,连续性,通道数,行列式满足一定条件的话就返回</span><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">元素的个数和其通道数的乘积,否则返回</span><span style="font-family:Calibri">-1</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">8 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">clone</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">创建一个数字及其基础数据的完整副本</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">9 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">col</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">创建一个指定列数的矩阵头</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">10 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">colRange</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">创建指定列跨度的矩阵头</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">11 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">convertTo</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">在缩放或不缩放的情况下转换为另一种数据类型</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(255, 255, 0); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">12 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(255, 255, 0); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">copySize</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(255, 255, 0); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">【查不到】</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">13 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">copyTo</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">把矩阵复制到另一个矩阵中</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">14 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">create</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">分配新的阵列数据</span> <span style="font-family:宋体">(如果需要)</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">15 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">cross</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">计算</span><span style="font-family:Calibri">3</span><span style="font-family:宋体">元素向量的一个叉乘积</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(255, 255, 0); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">16 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(255, 255, 0); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">deallocate</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(255, 255, 0); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">【查不到】</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">17 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">depth</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回一个矩阵元素的深度</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">18 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">diag</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">提取或创建矩阵对角线,</span><span style="font-family:Calibri">d = 0</span><span style="font-family:宋体">:全图对角线,</span><span style="font-family:Calibri">d > 0</span><span style="font-family:宋体">:下半部分对角线数据,</span><span style="font-family:Calibri">d < 0</span><span style="font-family:宋体">:上半部分对角线数据</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">19 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">dot</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">计算两向量的点乘</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">20 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">elemSize</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">返回矩阵元素大小</span> <span style="font-family:宋体">(以字节为单位)</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">21 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">elemSize1</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">以字节为单位返回每个矩阵元素通道的大小</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">22 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">empty</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">如果数组有没有</span> <span style="font-family:Calibri">elemens</span><span style="font-family:宋体">,则返回 </span><span style="font-family:Calibri">true</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">23 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">end</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">返回矩阵迭代器,并将其设置为</span> <span style="font-family:宋体">最后元素之后(</span><span style="font-family:Calibri">after-last</span><span style="font-family:宋体">)的矩阵元</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">24 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">eye</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回一个恒等指定大小和类型矩阵</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">25 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">inv</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">反转矩阵</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">26 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">isContinuous</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回矩阵是否连续</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">27 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">isSubmatrix</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">检查是否为子矩阵</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">28 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">locateROI</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">父矩阵内定位矩阵头</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">29 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">mul</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">执行两个矩阵按元素相乘或这两个矩阵的除法</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">30 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">ones</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">返回一个指定的大小和类型的全为</span><span style="font-family:Calibri">1</span><span style="font-family:宋体">的数组</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">31 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">pop_back</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">从底部的列表中删除元素</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">32 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">ptr</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回指定矩阵行的指针</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">33 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">push_back</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">将元素添加到矩阵的底部</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(255, 255, 0); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">34 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(255, 255, 0); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">push_back_</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(255, 255, 0); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">【查不到】</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">35 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">release</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">在必要的情况下,递减引用计数并释放该矩阵</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">36 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">reserve</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">保留一定数量的行的空间</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">37 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">reshape</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">在无需复制数据的前提下改变</span><span style="font-family:Calibri">2D</span><span style="font-family:宋体">矩阵的形状和通道数或其中之一</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">38 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">resize</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">更改矩阵的行数</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">39 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">row</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">创建一个指定行数的矩阵头</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">40 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">rowRange</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">创建指定行跨度(</span><span style="font-family:Calibri">span</span><span style="font-family:宋体">)的矩阵头</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">41 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">setTo</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">将阵列中所有的或部分的元素设置为指定的值</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">42 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">step1</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回矩阵归一化迈出的一步</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">43 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">t</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">通过矩阵表达式(</span><span style="font-family:Calibri">matrix expression</span><span style="font-family:宋体">)实现矩阵的转置</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">44 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">total</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回数组元素的总数</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">45 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">type</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回一个矩阵元素的类型</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">46 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">zeros</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回指定的大小和类型的零数组</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">47 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">~Mat</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">t</span><span style="font-family:宋体">的析构函数。</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">48 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">operator</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">提供矩阵赋值操作(非函数)</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">49 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">operator</span></span><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">()</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">提取矩阵子阵</span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">50 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">operator</span></span><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri"> </span><span style="font-family:Calibri">CvMat</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">创建矩阵</span><span style="font-family:Calibri">CvMat</span><span style="font-family:宋体">头</span></span></p></td></tr><tr><td width="48" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">51 </span></p></td><td width="117" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">operator</span></span><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri"> </span><span style="font-family:Calibri">IplImage</span></span></p></td><td width="403" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; background: rgb(219, 238, 243); border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">创建</span><span style="font-family:Calibri">IplImage</span><span style="font-family:宋体">矩阵头</span></span></p></td></tr></tbody></table><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">类成员函数参数名称的含义:</span></span></p><table border="1" style="border-right: none; border-bottom: none; border-image: initial; border-left: 1px solid rgb(102, 102, 102); border-top: 1px solid rgb(102, 102, 102);"><tbody><tr class="firstRow"><td width="46" valign="top" style="border-width: 1px; border-color: windowtext rgb(102, 102, 102) rgb(102, 102, 102) windowtext; border-bottom-style: solid; border-right-style: solid; padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px">序号</span></p></td><td width="80" valign="top" style="border-width: 1px; border-color: windowtext rgb(102, 102, 102) rgb(102, 102, 102) windowtext; border-bottom-style: solid; border-right-style: solid; padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px">参数</span></p></td><td width="442" valign="top" style="border-width: 1px; border-color: windowtext rgb(102, 102, 102) rgb(102, 102, 102) windowtext; border-bottom-style: solid; border-right-style: solid; padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px">含义</span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">1</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">ndims</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">数组的维数</span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">2</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">rows</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">二维数组的行数</span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">3</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">cols</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">二维数组的列数</span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">4</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">size</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">二维数组的尺寸</span><span style="font-family:Calibri">Size(cols, rows)</span><span style="font-family:宋体">,在</span><span style="font-family:Calibri">Size()</span><span style="font-family:宋体">构造函数函数中行数和列数在顺序上为反转过来的</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">5</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">sizes</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">指定</span><span style="font-family:Calibri">n</span><span style="font-family:宋体">维数组形状的整数数组</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">6</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">type</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">数组的类型。使用</span><span style="font-family:Calibri">CV_8UC1</span><span style="font-family:宋体">,</span><span style="font-family:Calibri">... ... </span><span style="font-family:宋体">,创建</span><span style="font-family:Calibri">1-4</span><span style="font-family:宋体">通道的矩阵,</span><span style="font-family:Calibri">CV_64FC4</span><span style="font-family:宋体">或</span><span style="font-family:Calibri">CV_8UC(n)</span><span style="font-family:宋体">,</span><span style="font-family:Calibri">... ...</span><span style="font-family:宋体">,</span><span style="font-family:Calibri">CV_64FC(n)</span><span style="font-family:宋体">可以创建多通道(高达</span><span style="font-family:Calibri">CV_MAX_CN</span><span style="font-family:宋体">通道)矩阵</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">7</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">s</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">一个可选的初始化每个矩阵元素的参数。要在矩阵建成后将所有元素设置为特定值可以用</span><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">的赋值运算符</span><span style="font-family:Calibri">Mat:operator=(constScala& value)</span><span style="font-family:宋体">。</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">8</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">data</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">指向用户数据的指针。矩阵构造函数传入</span><span style="font-family:Calibri">data</span><span style="font-family:宋体">和</span><span style="font-family:Calibri">step</span><span style="font-family:宋体">参数不分配矩阵数据。相反,它们只是初始化矩阵头指向指定的数据,这意味着没有数据的复制。此操作是很高效的,可以用来处理使用 </span><span style="font-family:Calibri">OpenCV </span><span style="font-family:宋体">函数的外部数据。外部数据不会自动释放,所以你应该小心处理它。</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">9</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">step</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">每个矩阵行占用的字节数。如果任何值应包括每行末尾的填充字节。如果缺少此参数(设置为</span> <span style="font-family:Calibri">AUTO_STEP</span><span style="font-family:宋体">),假定没有填充和实际的步长用</span><span style="font-family:Calibri">cols*elemSize()</span><span style="font-family:宋体">计算。请参阅</span><span style="font-family:Calibri">Mat::elemSize()</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">9</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">steps</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">多维数组(最后一步始终设置为元素大小)</span> <span style="font-family:宋体">的情况下的</span> <span style="font-family:Calibri">ndims-1</span><span style="font-family:宋体">个步长的数组。如果没有指定的话,该矩阵假定为连续。</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">10</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">M</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">分配给构造出来的矩阵的阵列(作为一个整体或部分)。这些构造函数没有复制数据。相反,指向</span> <span style="font-family:Calibri">m </span><span style="font-family:宋体">的数据或它的子数组的头被构造并被关联到</span><span style="font-family:Calibri">m</span><span style="font-family:宋体">上。引用计数器中无论如何都将递增。所以,当您修改矩阵的时候,自然而然就使用了这种构造函数,您还修改 </span><span style="font-family:Calibri">m </span><span style="font-family:宋体">中的对应元素。如果你想要独立的子数组的副本,请使用 </span><span style="font-family:Calibri">Mat::clone()</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">11</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">img</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">指向老版本的</span> <span style="font-family:Calibri">IplImage</span><span style="font-family:宋体">图像结构的指针。默认情况下,原始图像和新矩阵之间共享数据。但当 </span><span style="font-family:Calibri">copyData </span><span style="font-family:宋体">被设置时,完整的图像数据副本就创建起来了</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">12</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">vec</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">矩阵的元素构成的</span><span style="font-family:Calibri">STL </span><span style="font-family:宋体">向量。矩阵可以取出单独一列并且该列上的行数和矢量元素的数目相同。矩阵的类型匹配的向量元素的类型。构造函数可以处理任意的有正确声明的</span><span style="font-family:Calibri">DataType</span><span style="font-family:宋体">类型。这意味着矢量元素不支持的混合型结构,它们必须是数据(</span><span style="font-family:Calibri">numbers</span><span style="font-family:宋体">)原始数字或单型数值元组。对应的构造函数是显式的。由于 </span><span style="font-family:Calibri">STL </span><span style="font-family:宋体">向量不会自动转换为</span><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">实例,您应显式编写 </span><span style="font-family:Calibri">Mat(vec)</span><span style="font-family:宋体">。除非您将数据复制到矩阵 (</span><span style="font-family:Calibri">copyData = true</span><span style="font-family:宋体">),没有新的元素被添加到向量中,因为这样可能会造成矢量数据重新分配,并且因此使得矩阵的数据指针无效</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">13</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">copyData</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">指定</span><span style="font-family:Calibri">STL </span><span style="font-family:宋体">向量或旧型 </span><span style="font-family:Calibri">CvMat </span><span style="font-family:宋体">或 </span><span style="font-family:Calibri">IplImage</span><span style="font-family:宋体">是应复制到 </span><span style="font-family:Calibri">(true)</span><span style="font-family:宋体">新构造的矩阵中 还是 </span><span style="font-family:Calibri">(false) </span><span style="font-family:宋体">与之共享基础数据的标志,复制数据时,使用</span><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">引用计数机制管理所分配的缓冲区。虽然数据共享的引用计数为 </span><span style="font-family:Calibri">NULL</span><span style="font-family:宋体">,但是分配数据必须在矩阵被析构之后才可以释放</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">14</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">rowRange</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">m </span><span style="font-family:宋体">的行数的取值范围。正常情况下,范围开始端具有包容性和范围结束端是独占的。使用 </span><span style="font-family:Calibri">Range::all() </span><span style="font-family:宋体">来取所有的行。</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">15</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">colRange</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">m </span><span style="font-family:宋体">列数的取值范围。使用 </span><span style="font-family:Calibri">Range::all() </span><span style="font-family:宋体">来取所有的列</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">16</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">ranges</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">表示</span><span style="font-family:Calibri">M</span><span style="font-family:宋体">沿每个维度选定的区域的数组</span></span></p></td></tr><tr><td width="46" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:center"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">17</span></span></p></td><td width="80" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">expr</span></span></p></td><td width="442" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">矩阵表达式。请参见</span><span style="font-family:宋体">“矩阵表达式”一节的内容</span></span></p></td></tr></tbody></table><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">以上这些都是</span><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">形成一个矩阵的各类构造函数。如输出数据的自动分配中所提到的,往往默认构造函数就足够了,不同的矩阵可以由 </span><span style="font-family:Calibri">OpenCV </span><span style="font-family:宋体">函数来分配数据空间。构造的矩阵可以进一步分配给另一个矩阵或矩阵表达或通过</span><span style="font-family:Calibri">Mat::create()</span><span style="font-family:宋体">获配。在前一种情况,旧的内容是间接引用的。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">Mat_<uchar></span><span style="font-family:宋体">对应的是</span><span style="font-family:Calibri">CV_8U</span><span style="font-family:宋体">,</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">Mat_<char></span><span style="font-family:宋体">对应的是</span><span style="font-family:Calibri">CV_8S</span><span style="font-family:宋体">,</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">Mat_<int></span><span style="font-family:宋体">对应的是</span><span style="font-family:Calibri">CV_32S</span><span style="font-family:宋体">,</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">Mat_<float></span><span style="font-family:宋体">对应的是</span><span style="font-family:Calibri">CV_32F</span><span style="font-family:宋体">,</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">Mat_<double></span><span style="font-family:宋体">对应的是</span><span style="font-family:Calibri">CV_64F</span><span style="font-family:宋体">,对应的数据深度如下:</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_8U-8 </span><span style="font-family:宋体">位无符号整数 (</span><span style="font-family:Calibri">0</span><span style="font-family:宋体">…</span><span style="font-family:Calibri">..255</span><span style="font-family:宋体">)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_8S-8 </span><span style="font-family:宋体">位符号整数 (</span><span style="font-family:Calibri">-128</span><span style="font-family:宋体">…</span><span style="font-family:Calibri">..127</span><span style="font-family:宋体">)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_16U-16 </span><span style="font-family:宋体">位无符号整数 (</span><span style="font-family:Calibri">0</span><span style="font-family:宋体">……</span><span style="font-family:Calibri">65535</span><span style="font-family:宋体">)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_16S-16 </span><span style="font-family:宋体">位符号整数 (</span><span style="font-family:Calibri">-32768</span><span style="font-family:宋体">…</span><span style="font-family:Calibri">..32767</span><span style="font-family:宋体">)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_32S-32 </span><span style="font-family:宋体">位符号整数 (</span><span style="font-family:Calibri">-2147483648</span><span style="font-family:宋体">……</span><span style="font-family:Calibri">2147483647</span><span style="font-family:宋体">)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_32F-32 </span><span style="font-family:宋体">位浮点数 (</span><span style="font-family:Calibri">-FLT_MAX </span><span style="font-family:宋体">………</span><span style="font-family:Calibri">FLT_MAX</span><span style="font-family:宋体">,</span><span style="font-family:Calibri">INF</span><span style="font-family:宋体">,</span><span style="font-family:Calibri">NAN)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_64F-64 </span><span style="font-family:宋体">位浮点数(</span><span style="font-family:Calibri">-DBL_MAX </span><span style="font-family:宋体">………</span><span style="font-family:Calibri">.DBL_MAX</span><span style="font-family:宋体">,</span><span style="font-family:Calibri">INF</span><span style="font-family:宋体">,</span><span style="font-family:Calibri">NAN)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">要少使用</span><span style="font-family:Calibri">CV_64F</span><span style="font-family:宋体">,但是</span><span style="font-family:Calibri">vs</span><span style="font-family:宋体">的编译器又会把</span><span style="font-family:Calibri">float</span><span style="font-family:宋体">数据自动变成</span><span style="font-family:Calibri">double</span><span style="font-family:宋体">型,有些不太爽。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">还有个需要注意的问题,就是流操作符</span><span style="font-family:Calibri"><<</span><span style="font-family:宋体">对于</span><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">的操作,仅限于</span><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">是</span><span style="font-family:Calibri">2</span><span style="font-family:宋体">维的情况。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">还有必要说一下</span><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">的存储是逐行的存储的。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">再说说</span><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">的创建,方式有两种,罗列一下:</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">1. </span><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">调用</span><span style="font-family:Calibri">create</span><span style="font-family:宋体">(行,列,类型)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">2. </span><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">(行,列,类型(值))。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="background:rgb(0,176,80)"><strong><span style="font-family: 宋体;font-size: 20px">成员函数详细说明</span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">在</span> <span style="font-family:Calibri">Mat </span><span style="font-family:宋体">类中有着众多的成员函数,后面会对所有成员函数进行详细的功能解读。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat row(int y)</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">获取</span> <span style="font-family:Calibri">y </span><span style="font-family:宋体">列数据。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat col(int x) const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">获取</span> <span style="font-family:Calibri">x </span><span style="font-family:宋体">值。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat rowRange(int startrow, int endrow) const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">获取起始列和结束列区域的数据</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat rowRange(const Range& r) const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">用</span> <span style="font-family:Calibri">r </span><span style="font-family:宋体">内的数据设定起始和结束列</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat colRange(int startcol, int endcol) const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">获取行数据,其余同上</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat colRange(const Range& r) const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">获取行数据,其余同上</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat diag(int d=0) const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">获取对角线数据:</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">d = 0</span><span style="font-family:宋体">:全图对角线</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">d > 0</span><span style="font-family:宋体">:下帮部分对角线数据</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">d < 0</span><span style="font-family:宋体">:上半部分对角线数据</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat clone() const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">创建数据副本。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">与</span> <span style="font-family:Calibri">Mat1 = Mat2 </span><span style="font-family:宋体">不同,</span><span style="font-family:Calibri">Mat2 </span><span style="font-family:宋体">被清除后 </span><span style="font-family:Calibri">Mat1 </span><span style="font-family:宋体">数据也会被清除。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">Mat1 = Mat2.clone()</span><span style="font-family:宋体">在 </span><span style="font-family:Calibri">Mat2 </span><span style="font-family:宋体">被改变后 </span><span style="font-family:Calibri">Mat1 </span><span style="font-family:宋体">不会被改变</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void copyTo( OutputArray m ) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">复制数据到</span> <span style="font-family:Calibri">m </span><span style="font-family:宋体">中</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void copyTo( OutputArray m, InputArray mask ) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">复制</span> <span style="font-family:Calibri">mask </span><span style="font-family:宋体">设定的部分数据到 </span><span style="font-family:Calibri">m </span><span style="font-family:宋体">中</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">转换矩阵存储类型,具体计算公式如下:</span></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">m(x,y)=saturate_cast<rType>(</span><span style="font-family:宋体">α</span><span style="font-family:Calibri">(</span><span style="font-family:宋体">∗</span><span style="font-family:Calibri">this)(x,y)+</span><span style="font-family:宋体">β</span><span style="font-family:Calibri">)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">m </span><span style="font-family:宋体">是输入矩阵,</span><span style="font-family:Calibri">rtype </span><span style="font-family:宋体">是目标类型,</span><span style="font-family:Calibri">alpha </span><span style="font-family:宋体">是放缩系数,</span><span style="font-family:Calibri">beta </span><span style="font-family:宋体">是增减标量。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">这个函数也至关重要,因为在数字图像处理中,矩阵是最基本的运算单位,而矩阵的数</span> <span style=";font-family:宋体;font-size:14px">据类型转换全靠该函数来实现。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void assignTo( Mat& m, int type=-1 ) const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">功能同上,将数据转换到</span> <span style="font-family:Calibri">M </span><span style="font-family:宋体">矩阵中,</span><span style="font-family:Calibri">type </span><span style="font-family:宋体">设定目标数据</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat& operator = (const Scalar& s)</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">设置矩阵的所有像素点值为</span> <span style="font-family:Calibri">s</span><span style="font-family:宋体">。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat& setTo(InputArray value, InputArray mask=noArray())</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">设定矩阵中部分区域的值为</span> <span style="font-family:Calibri">value</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat reshape(int cn, int rows=0) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">改变通道数和行数或其中之一:</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">cn </span><span style="font-family:宋体">– 新的通道数。若 </span><span style="font-family:Calibri">cn=0</span><span style="font-family:宋体">,那么通道数就保持不变。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">rows </span><span style="font-family:宋体">–新的行数。 若 </span><span style="font-family:Calibri">rows = 0, </span><span style="font-family:宋体">那么行数保持不变</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat reshape(int cn, int newndims, const int* newsz) const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">改变通道数和数据维数或其中之一:</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">cn </span><span style="font-family:宋体">– 新的通道数。若 </span><span style="font-family:Calibri">cn=0</span><span style="font-family:宋体">,那么通道数就保持不变。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">newndims </span><span style="font-family:宋体">– 新的维数。 若 </span><span style="font-family:Calibri">= 0, </span><span style="font-family:宋体">那么维数保持不变。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">newsz </span><span style="font-family:宋体">– 新维平面的尺寸。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">MatExpr t() const;</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">获取转置矩阵。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">MatExpr inv(int method=DECOMP_LU) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">获取逆矩阵:</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">– </span><span style="font-family:Calibri">DECOMP_LU </span><span style="font-family:宋体">是 </span><span style="font-family:Calibri">LU </span><span style="font-family:宋体">分解一定不能是单数的。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">– </span><span style="font-family:Calibri">DECOMP_CHOLESKY </span><span style="font-family:宋体">是 </span><span style="font-family:Calibri">Cholesky LLT </span><span style="font-family:宋体">只适用于对称正矩阵的分解。该类型在处理大的矩阵时的速度是 </span><span style="font-family:Calibri">LU </span><span style="font-family:宋体">的两倍左右。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">– </span><span style="font-family:Calibri">DECOMP_SVD </span><span style="font-family:宋体">是 </span><span style="font-family:Calibri">SVD </span><span style="font-family:宋体">分解。如果矩阵是单数或甚至不是 </span><span style="font-family:Calibri">2 </span><span style="font-family:宋体">维,函数就会计算伪反转矩阵。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">MatExpr mul(InputArray m, double scale=1) const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">矩阵按元素进行乘法运算</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat cross(InputArray m) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">矩阵差乘</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat dot(InputArray m) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">矩阵点乘</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">static MatExpr zeros(int rows, int cols, int type);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">static MatExpr zeros(Size size, int type);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">static MatExpr zeros(int ndims, const int* sz, int type);</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">设置</span> <span style="font-family:Calibri">0 </span><span style="font-family:宋体">矩阵</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">static MatExpr ones(int rows, int cols, int type);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">static MatExpr ones(Size size, int type);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">static MatExpr ones(int ndims, const int* sz, int type);</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">设置</span> <span style="font-family:Calibri">1 </span><span style="font-family:宋体">矩阵</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">static MatExpr eye(int rows, int cols, int type);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">static MatExpr eye(Size size, int type);</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">设置对角线维</span> <span style="font-family:Calibri">1 </span><span style="font-family:宋体">的矩阵</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void create(int rows, int cols, int type);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void create(Size size, int type);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void create(int ndims, const int* sizes, int type);</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">设置类型中的变量数据</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void addref();</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">refcount;</span><span style="font-family:宋体">成员变量自加一</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">该方法递增与矩阵数据关联的引用计数。如果矩阵头指向外部的数据集(见</span> <span style="font-family:Calibri">Mat::Mat()</span><span style="font-family:宋体">),则引用计数为 </span><span style="font-family:Calibri">NULL</span><span style="font-family:宋体">,并且该方法在这种情况下不起作用。通常情况下,为避免内存泄漏,不应显式调用该方法。它是由该矩阵赋值运算符隐式调用。在支持的它平台上,引用计数器递增是一个原子操作。因此,对相同的矩阵,在不同的线程异步操作是安全的。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void release();</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">在必要的情况下,递减引用计数并释放该矩阵。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">该方法递减与矩阵的数据关联的引用计数。当引用计数减为</span> <span style="font-family:Calibri">0 </span><span style="font-family:宋体">时,矩阵的数据将被释放,数据和引用计数器指针设置为 </span><span style="font-family:Calibri">NULL</span><span style="font-family:宋体">。如果矩阵头指向外部数据集 (见 </span><span style="font-family:Calibri">Mat::Mat()</span><span style="font-family:宋体">), 引用计数为 </span><span style="font-family:Calibri">NULL</span><span style="font-family:宋体">,并且该方法在这种情况下无效。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">可以手动调用此方法强制矩阵数据释放。但由于这种方法在析构函数中是自动调用的,</span><span style="font-family: 宋体; font-size: 14px;">或以更改数据指针的其他方法,因此通常不需要调用这个函数。在支持它的平台上,引用计</span><span style="font-family: 宋体; font-size: 14px;">数器递减并检查是否为</span><span style="font-family: 宋体; font-size: 14px;"> </span><span style="font-size: 14px; font-family: Calibri;">0 </span><span style="font-family: 宋体; font-size: 14px;">是一个原子操作。因此,在不同的线程异步调用相同的矩阵是安</span><span style="font-family: 宋体; font-size: 14px;">全的操作。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void resize(size_t sz);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void resize(size_t sz, const Scalar& s);</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">调整</span> <span style="font-family:Calibri">Mat </span><span style="font-family:宋体">尺寸,</span><span style="font-family:Calibri">sz</span><span style="font-family:宋体">:新增加行列数量</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">s</span><span style="font-family:宋体">:新增行列数据值</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">void reserve(size_t sz);</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">调整</span> <span style="font-family:Calibri">Mat </span><span style="font-family:宋体">到只有 </span><span style="font-family:Calibri">sz </span><span style="font-family:宋体">的行列尺寸</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void push_back_(const void* elem);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void push_back(const Mat& m)</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">elem </span><span style="font-family:宋体">–增加的一个或多个元素。</span><span style="font-family:Calibri">m </span><span style="font-family:宋体">–增加的一个 </span><span style="font-family:Calibri">Mat</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">该方法将一个或多个元素添加到矩阵的底部。他们是模拟相应的</span> <span style="font-family:Calibri">STL </span><span style="font-family:宋体">向量类的方法。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">元素为</span> <span style="font-family:Calibri">Mat </span><span style="font-family:宋体">时,其类型和列的数目必须和矩阵容器是相同的。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void pop_back(size_t nelems=1);</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">nelems </span><span style="font-family:宋体">–删除的行的数目。如果它大于总的行数,则会引发异常。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">该方法从底部的列表中删除一行或多行。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">void locateROI( Size& wholeSize, Point& ofs ) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">父矩阵内定位矩阵头。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">wholeSize</span><span style="font-family:宋体">–输出参数,其中包含的整个矩阵包含大小 </span><span style="font-family:Calibri">* </span><span style="font-family:宋体">这是其中一部分。</span></span><span style="font-size: 14px; font-family: Calibri;">ofs </span><span style="font-family: 宋体; font-size: 14px;">–输出参数包含</span><span style="font-size: 14px; font-family: Calibri;">*this </span><span style="font-family: 宋体; font-size: 14px;">在整个的矩阵里面的偏移量。你使用 </span><span style="font-size: 14px; font-family: Calibri;">Mat::row()</span><span style="font-family: 宋体; font-size: 14px;">、 </span><span style="font-size: 14px; font-family: Calibri;">Mat::col()</span><span style="font-family: 宋体; font-size: 14px;">、</span><span style="font-size: 14px; font-family: Calibri;">Mat::rowRange()</span><span style="font-family: 宋体; font-size: 14px;">、</span><span style="font-size: 14px; font-family: Calibri;">Mat::colRange()</span><span style="font-family: 宋体; font-size: 14px;">以及其他的方法从矩阵中提取子阵后该结果子阵只指向</span><span style="font-family: 宋体; font-size: 14px;">原始大矩阵的一部分。然而,每个子阵包含有助于重建的最初矩阵大小和提取子阵在原始矩</span><span style="font-family: 宋体; font-size: 14px;">阵中的位置信息(由</span><span style="font-family: 宋体; font-size: 14px;"> </span><span style="font-size: 14px; font-family: Calibri;">datastart </span><span style="font-family: 宋体; font-size: 14px;">和 </span><span style="font-size: 14px; font-family: Calibri;">dataend </span><span style="font-family: 宋体; font-size: 14px;">fi</span><span style="font-size: 14px; font-family: Calibri;">elds </span><span style="font-family: 宋体; font-size: 14px;">表示)。</span><span style="font-size: 14px; font-family: Calibri;">locateROI </span><span style="font-family: 宋体; font-size: 14px;">方法正是这样做的。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat& adjustROI( int dtop, int dbottom, int dleft, int dright );</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">调整子阵大小及其在父矩阵中的位置。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">dtop </span><span style="font-family:宋体">–顶部子阵边界向上的平移量。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">dbottom </span><span style="font-family:宋体">–底部子阵边界向下的平移量。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">dleft </span><span style="font-family:宋体">–左子阵边界向左的平移量。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">dright </span><span style="font-family:宋体">–右子阵边界向右的平移量。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">该方法是</span> <span style="font-family:Calibri">Mat::locateROI() </span><span style="font-family:宋体">的互补性方法。这些函数的典型应用是确定父矩阵中子阵的位置,然后以某种方式改变位置。尤其典型的是,当滤镜操作中要考虑 </span><span style="font-family:Calibri">ROI </span><span style="font-family:宋体">外的像素时就需要它。当方法的所有参数都是正的时候,</span><span style="font-family:Calibri">ROI </span><span style="font-family:宋体">需要以指定量全方位增长,例如:</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">A.adjustROI(2, 2, 2,2);</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">在此示例中,每个方向</span> <span style="font-family:Calibri">4 </span><span style="font-family:宋体">元素增加矩阵大小。矩阵向左侧和上侧分别平移 </span><span style="font-family:Calibri">2 </span><span style="font-family:宋体">个元素,</span></span><span style="font-family: 宋体; font-size: 14px;">这会产生</span><span style="font-family: 宋体; font-size: 14px;"> </span><span style="font-size: 14px; font-family: Calibri;">5 x 5 </span><span style="font-family: 宋体; font-size: 14px;">内核的滤镜所需的所有像素。你的责任是确保 </span><span style="font-size: 14px; font-family: Calibri;">adjustROI </span><span style="font-family: 宋体; font-size: 14px;">不超出父矩阵边</span><span style="font-family: 宋体; font-size: 14px;">界。如果超出,该函数发出错误提示。</span><span style="font-size: 14px; font-family: Calibri;">OpenCV </span><span style="font-family: 宋体; font-size: 14px;">的滤镜函数在内部调用该函数,像 </span><span style="font-size: 14px; font-family: Calibri;">filter2D()</span><span style="font-family: 宋体; font-size: 14px;">,</span><span style="font-family: 宋体; font-size: 14px;">形态学的操作,等等。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat operator()( Range rowRange, Range colRange ) const;</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat operator()( const Rect& roi ) const;</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat operator()( const Range* ranges ) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">提取矩形子阵</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">rowRange </span><span style="font-family:宋体">–提取的子阵的开始和结束的行。不包括的上限。若要选择的所有行,请使</span></span><span style="font-family: 宋体; font-size: 14px;">用</span><span style="font-family: 宋体; font-size: 14px;"> </span><span style="font-size: 14px; font-family: Calibri;">Range::all()</span><span style="font-family: 宋体; font-size: 14px;">。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">colRange </span><span style="font-family:宋体">–提取的子阵的开始和结束的列。不包括的上限。若要选择的所有列,请使用</span><span style="font-family:Calibri">Range::all()</span><span style="font-family:宋体">。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">roi </span><span style="font-family:宋体">– 抽出子阵 </span><span style="font-family:Calibri">speci</span><span style="font-family:宋体">fi</span><span style="font-family:Calibri">ed </span><span style="font-family:宋体">作为一个矩形。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">ranges </span><span style="font-family:宋体">– 选定范围沿每个数组维度的数组。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">该运算符为</span><span style="font-family:Calibri">*this </span><span style="font-family:宋体">的子数组创建新的头。他们是 </span><span style="font-family:Calibri">Mat::row()</span><span style="font-family:宋体">、</span><span style="font-family:Calibri">Mat::col()</span><span style="font-family:宋体">、</span><span style="font-family:Calibri">Mat::rowRange()</span><span style="font-family:宋体">,</span></span><span style="font-family: 宋体; font-size: 14px;">和</span><span style="font-family: 宋体; font-size: 14px;"> </span><span style="font-size: 14px; font-family: Calibri;">Mat::colRange()</span><span style="font-family: 宋体; font-size: 14px;">最普遍的形式。例如,</span><span style="font-size: 14px; font-family: Calibri;">A(Range(0, 10),Range::all()) </span><span style="font-family: 宋体; font-size: 14px;">是相当于 </span><span style="font-size: 14px; font-family: Calibri;">A.rowRange(0,</span><span style="font-size: 14px; font-family: Calibri;">10)</span><span style="font-family: 宋体; font-size: 14px;">。与上述所有操作相同,该操作运算符是复杂度为 </span><span style="font-size: 14px; font-family: Calibri;">O(1)</span><span style="font-family: 宋体; font-size: 14px;">的操作,就是没有矩阵数据将被</span><span style="font-family: 宋体; font-size: 14px;">复制。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">bool isContinuous() const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回矩阵是否连续。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">//! returns true if the matrix is a submatrix of another matrix</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">bool isSubmatrix() const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回矩阵是否子矩阵。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">size_t elemSize() const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">返回矩阵元素大小</span> <span style="font-family:宋体">(以字节为单位)。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">该方法返回以字节为单位的矩阵元素大小。例如,如果矩阵类型是</span> <span style="font-family:Calibri">CV_16SC3</span><span style="font-family:宋体">,该方法返回 </span><span style="font-family:Calibri">3*sizeof(short)</span><span style="font-family:宋体">或 </span><span style="font-family:Calibri">6</span><span style="font-family:宋体">。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">size_t elemSize1() const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">以字节为单位返回每个矩阵元素通道的大小。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">该方法返回以字节为单位的矩阵元素通道大小,也就是忽略通道的数量。例如,如果矩阵类型是</span> <span style="font-family:Calibri">CV_16SC3</span><span style="font-family:宋体">,该方法返回 </span><span style="font-family:Calibri">sizeof(short) </span><span style="font-family:宋体">或 </span><span style="font-family:Calibri">2</span><span style="font-family:宋体">。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">int type() const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回一个矩阵元素的类型。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">int depth() const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回一个矩阵元素的深度。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_8U-8 </span><span style="font-family:宋体">位无符号整数 (</span><span style="font-family:Calibri">0</span><span style="font-family:宋体">…</span><span style="font-family:Calibri">..255</span><span style="font-family:宋体">)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_8S-8 </span><span style="font-family:宋体">位符号整数 (</span><span style="font-family:Calibri">-128</span><span style="font-family:宋体">…</span><span style="font-family:Calibri">..127</span><span style="font-family:宋体">)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_16U-16 </span><span style="font-family:宋体">位无符号整数 (</span><span style="font-family:Calibri">0</span><span style="font-family:宋体">……</span><span style="font-family:Calibri">65535</span><span style="font-family:宋体">)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_16S-16 </span><span style="font-family:宋体">位符号整数 (</span><span style="font-family:Calibri">-32768</span><span style="font-family:宋体">…</span><span style="font-family:Calibri">..32767</span><span style="font-family:宋体">)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_32S-32 </span><span style="font-family:宋体">位符号整数 (</span><span style="font-family:Calibri">-2147483648</span><span style="font-family:宋体">……</span><span style="font-family:Calibri">2147483647</span><span style="font-family:宋体">)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_32F-32 </span><span style="font-family:宋体">位浮点数 (</span><span style="font-family:Calibri">-FLT_MAX </span><span style="font-family:宋体">………</span><span style="font-family:Calibri">FLT_MAX</span><span style="font-family:宋体">,</span><span style="font-family:Calibri">INF</span><span style="font-family:宋体">,</span><span style="font-family:Calibri">NAN)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">• </span><span style="font-family:Calibri">CV_64F-64 </span><span style="font-family:宋体">位浮点数(</span><span style="font-family:Calibri">-DBL_MAX </span><span style="font-family:宋体">………</span><span style="font-family:Calibri">.DBL_MAX</span><span style="font-family:宋体">,</span><span style="font-family:Calibri">INF</span><span style="font-family:宋体">,</span><span style="font-family:Calibri">NAN)</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">int channels() const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回矩阵通道的数目。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">size_t step1(int i=0) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回矩阵归一化迈出的一步。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">该方法返回以矩阵的</span> <span style="font-family:Calibri">step </span><span style="font-family:宋体">除以 </span><span style="font-family:Calibri">Mat::elemSize1()</span><span style="font-family:宋体">。它对快速访问任意矩阵元素很有用。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">bool empty() const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">如果数组有没有</span> <span style="font-family:Calibri">elemens</span><span style="font-family:宋体">,则返回 </span><span style="font-family:Calibri">true</span><span style="font-family:宋体">。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">size_t total() const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回数组元素的总数。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">uchar* ptr(int i0=0);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">const uchar* ptr(int i0=0) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回指定矩阵行的指针。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">uchar* ptr(int i0, int i1);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">const uchar* ptr(int i0, int i1) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回指定二维矩阵行指针</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">uchar* ptr(int i0, int i1, int i2);</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">const uchar* ptr(int i0, int i1, int i2) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回指定三维矩阵的行指针</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">uchar* ptr(const int* idx);</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回矩阵元素的指针</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">const uchar* ptr(const int* idx) const;</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回到矩阵元素的只读指针</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename T> T& Mat::at(int i)const</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename T> const T&Mat::at(int i) const</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename T> T& Mat::at(int i,int j)</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename T> const T&Mat::at(int i, int j) const</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename T> T& Mat::at(Pointpt)</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename T> const T&Mat::at(Point pt) const</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename T> T& Mat::at(int i,int j, int k)</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename T> const T&Mat::at(int i, int j, int k) const</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename T> T& Mat::at(constint* idx)</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename T> const T&Mat::at(const int* idx) const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回对指定数组元素</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">i </span><span style="font-family:宋体">–索引 </span><span style="font-family:Calibri">0 </span><span style="font-family:宋体">维度</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">j </span><span style="font-family:宋体">– </span><span style="font-family:Calibri">1 </span><span style="font-family:宋体">维度的索引</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">k </span><span style="font-family:宋体">– 沿 </span><span style="font-family:Calibri">2 </span><span style="font-family:宋体">维度的索引</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">pt </span><span style="font-family:宋体">– </span><span style="font-family:Calibri">Point(j,i) </span><span style="font-family:宋体">作为指定元素的位置。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">idx </span><span style="font-family:宋体">– </span><span style="font-family:Calibri">Mat::dims </span><span style="font-family:宋体">数组的索引。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">该模板方法返回指定数组元素的引用。为了具有更高的性能,索引范围检查只在调试配</span><span style="font-family: 宋体; font-size: 14px;">置下执行。请注意使用具有单个索引 <span style="font-family:Calibri">(i) </span>的变量可以访问的单行或单列的 <span style="font-family:Calibri">2 </span>维的数组元素。</span><span style="font-family: 宋体; font-size: 14px;">也就是比 方说,如果 <span style="font-family:Calibri">A </span>是 <span style="font-family:Calibri">1 x N </span>浮点矩阵 和 <span style="font-family:Calibri">B </span>是 <span style="font-family:Calibri">M x 1 </span>的整数矩 阵,您只需编 写</span><span style="font-family: 宋体; font-size: 14px;">A. </span><span style="font-family: 宋体; font-size: 14px;"><span style="font-family:Calibri">at<float>(k+4) </span>和 <span style="font-family:Calibri">B.at<int>(2*i+1) </span>分别代替 <span style="font-family:Calibri">A.at<float>(0,k+4)</span>和 <span style="font-family:Calibri">B.at<int>(2*i+1,0)</span>。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename _Tp>MatIterator_<_Tp> Mat::begin()</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename _Tp>MatConstIterator_<_Tp> Mat::begin() const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">返回矩阵迭代器,并将其设置为第一矩阵元。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">该方法返回矩阵的只读或读写的迭代器。矩阵迭代器的使用和双向</span> <span style="font-family:Calibri">STL </span><span style="font-family:宋体">迭代器的使用</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">是非常相似的。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename _Tp>MatIterator_<_Tp> Mat::end()</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">template<typename _Tp>MatConstIterator_<_Tp> Mat::end() const</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">返回矩阵迭代器,并将其设置为</span> <span style="font-family:宋体">最后元素之后(</span><span style="font-family:Calibri">after-last</span><span style="font-family:宋体">)的矩阵元。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">该方法返回矩阵只读或读写的迭代器,设置为紧随最后一个矩阵元素的点。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="background:rgb(0,176,80)"><strong><span style="font-family: 宋体;font-size: 20px"><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">类成员</span></span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">类成员名称的含义:</span></span></p><table border="1" style="border-right: none; border-bottom: none; border-image: initial; border-left: 1px solid rgb(102, 102, 102); border-top: 1px solid rgb(102, 102, 102);"><tbody><tr class="firstRow"><td width="50" valign="top" style="border-width: 1px; border-color: windowtext rgb(102, 102, 102) rgb(102, 102, 102) windowtext; border-bottom-style: solid; border-right-style: solid; padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">序号</span></p></td><td width="90" valign="top" style="border-width: 1px; border-color: windowtext rgb(102, 102, 102) rgb(102, 102, 102) windowtext; border-bottom-style: solid; border-right-style: solid; padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:center"><span style="font-family:宋体;font-size:14px">类名称</span></p></td><td width="428" valign="top" style="border-width: 1px; border-color: windowtext rgb(102, 102, 102) rgb(102, 102, 102) windowtext; border-bottom-style: solid; border-right-style: solid; padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:center"><span style="font-family:宋体;font-size:14px">含义</span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">1 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">allocator</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">如果需要创建一个新矩阵的内存空间,系统会调用</span> <span style="font-family:Calibri">MatAllocator </span><span style="font-family:宋体">类作为分配符进行内存的分配</span></span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">2 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">cols</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">图像数组的列数</span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">3 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">data</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">图像数据指针</span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">4 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">dataend</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">图像</span> <span style="font-family:Calibri">ROI </span><span style="font-family:宋体">数据结束地址</span></span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">5 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">datalimit</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">图像</span> <span style="font-family:Calibri">ROI </span><span style="font-family:宋体">实时数据地址</span></span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">6 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">datastart</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">图像</span> <span style="font-family:Calibri">ROI </span><span style="font-family:宋体">数据起始地址</span></span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">7 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">dims</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">图像数组的维度</span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">8 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">flags</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">数据是非连续的标志位</span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">9 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">refcount</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">它记录了这个矩阵的数据被其他变量引用了多少次</span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">10 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">rows</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">图像数组的行数</span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">11 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">size</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px">返回一个矩阵大小</span></p></td></tr><tr><td width="50" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left: 28px"><span style="font-family:Calibri;font-size:14px">12 </span></p></td><td width="90" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style="margin-left:0;text-indent:0;text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:Calibri">step</span></span></p></td><td width="428" valign="top" style="border-left-width: 1px; border-left-color: windowtext; border-top: none; border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); padding: 5px;"><p style=";text-align:justify;text-justify:inter-ideograph"><span style="font-family:宋体;font-size:14px"><span style="font-family:宋体">矩阵元素寻址。</span><span style="font-family:Calibri">step[i]</span><span style="font-family:宋体">是 </span><span style="font-family:Calibri">Mat </span><span style="font-family:宋体">类中十分重要的一个属性,表示第 </span><span style="font-family:Calibri">i </span><span style="font-family:宋体">维的总大小,单位字节 </span><span style="font-family:Calibri">.</span></span></p></td></tr></tbody></table><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">其他说明:</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;color: rgb(0, 176, 80);font-size: 14px"><span style="font-family:Calibri">int* refcount</span><span style="font-family:宋体">:</span></span></strong><strong><span style="font-family: 宋体;color: rgb(146, 208, 80);font-size: 14px">【二次开发的关键】</span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">它记录了这个矩阵的数据被其他变量引用了多少次。在</span> <span style="font-family:Calibri">c++</span><span style="font-family:宋体">中矩阵的一些赋值操作往往</span></span><span style="font-family: 宋体; font-size: 14px;">只给新的变量赋予一个新的头文件,而数据部分只把数据指针指过去,而不重新分为内存,</span><span style="font-family: 宋体; font-size: 14px;">需要程序员来管理内存。这样的话就会有隐患,因为如果原始的变量的数据内存释放了,新</span><span style="font-family: 宋体; font-size: 14px;">的变量却还在,指向了已经被释放的内存区域,如果对新变量进行操作,很可能出现意想不</span><span style="font-family: 宋体; font-size: 14px;">到的问题。不过不用担心,<span style="font-family:Calibri">OpenCV </span>的开发者早就想到了这个问题,并为我们想到了一个解</span><span style="font-family: 宋体; font-size: 14px;">决方法,那就是靠这个 <span style="font-family:Calibri">refcount </span>来记录该数据被多少变量共用,直到最后一个变量被释放</span><span style="font-family: 宋体; font-size: 14px;">时,才释放掉这个存储数据内存块。这也是为什么类定义中 <span style="font-family:Calibri">refcount </span>为指针,让实际记录</span><span style="font-family: 宋体; font-size: 14px;">次数的变量跟在矩阵数据最后面。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">保存图像像素数据的矩阵则会随着图像的大小而改变,通常数据量会很大,比矩阵头大</span><span style="font-family: 宋体; font-size: 14px;">几个数量级。这样,在图像复制和传递过程中,主要的开销是由存放图像像素的矩阵而引起</span><span style="font-family: 宋体; font-size: 14px;">的。因此,<span style="font-family:Calibri">OpenCV </span>使用了引用次数,当进行图像复制和传递时,不再复制整个 <span style="font-family:Calibri">Mat </span>数据,</span><span style="font-family: 宋体; font-size: 14px;">而只是复制矩阵头和指向像素矩阵的指针,但是其矩阵指针指向同一个矩阵,也就是其中任何一个改变了矩阵数据都会影响另外一个。</span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">这就是引用计数的作用,当</span> <span style="font-family:Calibri">Mat </span><span style="font-family:宋体">对象每被复制一次时,就会将引用计数加 </span><span style="font-family:Calibri">1</span><span style="font-family:宋体">,而每销毁一个 </span><span style="font-family:Calibri">Mat </span><span style="font-family:宋体">对象(共用同一个矩阵数据)时引用计数会被减 </span><span style="font-family:Calibri">1</span><span style="font-family:宋体">,当引用计数为 </span><span style="font-family:Calibri">0 </span><span style="font-family:宋体">时,矩阵数据会被清理。这就是 </span><span style="font-family:Calibri">refcount </span><span style="font-family:宋体">的作用。</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="background:rgb(0,176,80)"><strong><span style="font-family: 宋体;font-size: 20px">构造函数</span></strong></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;color: rgb(0, 176, 80);font-size: 14px">空构造</span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat()</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px">构造空的类,结构体全零初始化。</span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;color: rgb(0, 176, 80);font-size: 14px"><span style="font-family:Calibri">2D </span><span style="font-family:宋体">平面构造</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(int rows, int cols, int type)</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">构造</span> <span style="font-family:Calibri">cols </span><span style="font-family:宋体">行,</span><span style="font-family:Calibri">rows </span><span style="font-family:宋体">列,数据类型为 </span><span style="font-family:Calibri">type </span><span style="font-family:宋体">的类</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(int rows, int cols, int type, const Scalar& s);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">构造内容同上,增加了预装填数据</span> <span style="font-family:Calibri">s</span></span></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">构造内容同上,使用</span> <span style="font-family:Calibri">data </span><span style="font-family:宋体">指针指向数据进行初始化装填。</span></span></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(Size size, int type)</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">构造行列数量为</span> <span style="font-family:Calibri">size </span><span style="font-family:宋体">内装填值的 </span><span style="font-family:Calibri">type </span><span style="font-family:宋体">类型的类</span></span></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(Size size, int type, const Scalar& s);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">构造内容同上,增加了预装填数据</span> <span style="font-family:Calibri">s</span></span></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(Size size, int type, void* data, size_t step=AUTO_STEP);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">构造内容同上,使用</span> <span style="font-family:Calibri">data </span><span style="font-family:宋体">指针指向数据进行初始化装填。</span></span></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">//! constructor for matrix headers pointing to user-allocated data</span></span></p><p style=";text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;color: rgb(0, 176, 80);font-size: 14px"><span style="font-family:Calibri">nD </span><span style="font-family:宋体">矩阵构建</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(int ndims, const int* sizes, int type);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">构建带有</span> <span style="font-family:Calibri">ndims </span><span style="font-family:宋体">个 </span><span style="font-family:Calibri">2D </span><span style="font-family:宋体">平面的,大小存储在地址中的,</span><span style="font-family:Calibri">type </span><span style="font-family:宋体">类型数据矩阵类</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(int ndims, const int* sizes, int type, const Scalar& s);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">构造内容同上,增加了预装填数据</span> <span style="font-family:Calibri">s</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">构造内容同上,使用</span> <span style="font-family:Calibri">data </span><span style="font-family:宋体">指针指向数据进行初始化装填。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;color: rgb(0, 176, 80);font-size: 14px"><span style="font-family:宋体">使用</span> <span style="font-family:Calibri">Mat </span><span style="font-family:宋体">进行初始化</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(const Mat& m);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">复制已有的</span> <span style="font-family:Calibri">Mat</span><span style="font-family:宋体">,构造一个新的 </span><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">。其中所有的值都和已有的 </span><span style="font-family:Calibri">Mat </span><span style="font-family:宋体">相同。</span></span></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(const Mat& m, const Range& rowRange, const Range& colRange);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">复制已有</span> <span style="font-family:Calibri">Mat </span><span style="font-family:宋体">的部分列(</span><span style="font-family:Calibri">rowRange</span><span style="font-family:宋体">),部分行(</span><span style="font-family:Calibri">colRange</span><span style="font-family:宋体">)构建一个新的 </span><span style="font-family:Calibri">Mat </span><span style="font-family:宋体">类。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(const Mat& m, const Rect& roi);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">复制由</span> <span style="font-family:Calibri">Roi </span><span style="font-family:宋体">框选的已有 </span><span style="font-family:Calibri">Mat </span><span style="font-family:宋体">类部分数据,构建一个新的类</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(const Mat& m, const Range* ranges);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">复制</span> <span style="font-family:Calibri">Mat </span><span style="font-family:宋体">类总被 </span><span style="font-family:Calibri">ranges </span><span style="font-family:宋体">指针指向数据规定的范围数据,构建一个新的 </span><span style="font-family:Calibri">Mat</span><span style="font-family:宋体">。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style=";text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;color: rgb(0, 176, 80);font-size: 14px"><span style="font-family:Calibri">CvMat </span><span style="font-family:宋体">格式数据初始化 </span><span style="font-family:Calibri">Mat</span></span></strong></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(const CvMat* m, bool copyData=false);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">C </span><span style="font-family:宋体">语言格式数据 </span><span style="font-family:Calibri">CvMat </span><span style="font-family:宋体">来构造新的 </span><span style="font-family:Calibri">2D </span><span style="font-family:宋体">格式的 </span><span style="font-family:Calibri">Mat </span><span style="font-family:宋体">类,根据 </span><span style="font-family:Calibri">copyData </span><span style="font-family:宋体">判定是否复制数据。</span></span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(const CvMatND* m, bool copyData=false);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:Calibri">C </span><span style="font-family:宋体">语言格式数据 </span><span style="font-family:Calibri">CvMatND </span><span style="font-family:宋体">来构造新的 </span><span style="font-family:Calibri">ND </span><span style="font-family:宋体">格式的 </span><span style="font-family:Calibri">Mat </span><span style="font-family:宋体">类,根据 </span><span style="font-family:Calibri">copyData </span><span style="font-family:宋体">判定是否复制数据。</span></span></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"> </span></p><p style="text-indent:28px;text-align:justify;text-justify:inter-ideograph"><strong><span style="font-family: 宋体;font-size: 14px"><span style="font-family:Calibri">Mat(const IplImage* img, bool copyData=false);</span></span></strong></p><p style="margin-left:28px;text-indent:28px;text-align:justify;text-justify:inter-ideograph"><span style=";font-family:宋体;font-size:14px"><span style="font-family:宋体">使用</span> <span style="font-family:Calibri">OpenCV1.0 </span><span style="font-family:宋体">格式下最根本的图像数据存储结构体 </span><span style="font-family:Calibri">IplImage </span><span style="font-family:宋体">来构造新的 </span><span style="font-family:Calibri">2D </span><span style="font-family:宋体">格式的</span><span style="font-family:Calibri">Mat </span><span style="font-family:宋体">类,根据 </span><span style="font-family:Calibri">copyData </span><span style="font-family:宋体">判定是否复制数据。</span></span></p><p><br/></p>
OpenCV 常用函数与构造体详细说明
Mat 成员函数
Mat 成员函数如下:
序号
成员函数
功能
1
addref
计数器参考
2
adjustROI
调整子阵大小及其在父矩阵中的位置
3
assignTo
提供了一个 convertTo 的功能形式
4
at
返回对指定数组元素的引用
5
begin
返回矩阵迭代器,并将其设置为第一矩阵元
6
channels
返回矩阵通道的数目
7
checkVector
Mat 矩阵如果其深度,连续性,通道数,行列式满足一定条件的话就返回 Mat 元素的个数和其通道数的乘积,否则返回 -1
8
clone
创建一个数字及其基础数据的完整副本
9
col
创建一个指定列数的矩阵头
10
colRange
创建指定列跨度的矩阵头
11
convertTo
在缩放或不缩放的情况下转换为另一种数据类型
12
copySize
【查不到】
13
copyTo
把矩阵复制到另一个矩阵中
14
create
分配新的阵列数据 (如果需要)
15
cross
计算 3 元素向量的一个叉乘积
16
deallocate
【查不到】
17
depth
返回一个矩阵元素的深度
18
diag
提取或创建矩阵对角线, d = 0 :全图对角线, d > 0 :下半部分对角线数据, d < 0 :上半部分对角线数据
19
dot
计算两向量的点乘
20
elemSize
返回矩阵元素大小 (以字节为单位)
21
elemSize1
以字节为单位返回每个矩阵元素通道的大小
22
empty
如果数组有没有 elemens ,则返回 true
23
end
返回矩阵迭代器,并将其设置为 最后元素之后( after-last )的矩阵元
24
eye
返回一个恒等指定大小和类型矩阵
25
inv
反转矩阵
26
isContinuous
返回矩阵是否连续
27
isSubmatrix
检查是否为子矩阵
28
locateROI
父矩阵内定位矩阵头
29
mul
执行两个矩阵按元素相乘或这两个矩阵的除法
30
ones
返回一个指定的大小和类型的全为 1 的数组
31
pop_back
从底部的列表中删除元素
32
ptr
返回指定矩阵行的指针
33
push_back
将元素添加到矩阵的底部
34
push_back_
【查不到】
35
release
在必要的情况下,递减引用计数并释放该矩阵
36
reserve
保留一定数量的行的空间
37
reshape
在无需复制数据的前提下改变 2D 矩阵的形状和通道数或其中之一
38
resize
更改矩阵的行数
39
row
创建一个指定行数的矩阵头
40
rowRange
创建指定行跨度( span )的矩阵头
41
setTo
将阵列中所有的或部分的元素设置为指定的值
42
step1
返回矩阵归一化迈出的一步
43
t
通过矩阵表达式( matrix expression )实现矩阵的转置
44
total
返回数组元素的总数
45
type
返回一个矩阵元素的类型
46
zeros
返回指定的大小和类型的零数组
47
~Mat
t 的析构函数。
48
operator
提供矩阵赋值操作(非函数)
49
operator ()
提取矩阵子阵
50
operator CvMat
创建矩阵 CvMat 头
51
operator IplImage
创建 IplImage 矩阵头
Mat 类成员函数参数名称的含义:
序号
参数
含义
1
ndims
数组的维数
2
rows
二维数组的行数
3
cols
二维数组的列数
4
size
二维数组的尺寸 Size(cols, rows) ,在 Size() 构造函数函数中行数和列数在顺序上为反转过来的
5
sizes
指定 n 维数组形状的整数数组
6
type
数组的类型。使用 CV_8UC1 , ... ... ,创建 1-4 通道的矩阵, CV_64FC4 或 CV_8UC(n) , ... ... , CV_64FC(n) 可以创建多通道(高达 CV_MAX_CN 通道)矩阵
7
s
一个可选的初始化每个矩阵元素的参数。要在矩阵建成后将所有元素设置为特定值可以用 Mat 的赋值运算符 Mat:operator=(constScala& value) 。
8
data
指向用户数据的指针。矩阵构造函数传入 data 和 step 参数不分配矩阵数据。相反,它们只是初始化矩阵头指向指定的数据,这意味着没有数据的复制。此操作是很高效的,可以用来处理使用 OpenCV 函数的外部数据。外部数据不会自动释放,所以你应该小心处理它。
9
step
每个矩阵行占用的字节数。如果任何值应包括每行末尾的填充字节。如果缺少此参数(设置为 AUTO_STEP ),假定没有填充和实际的步长用 cols*elemSize() 计算。请参阅 Mat::elemSize()
9
steps
多维数组(最后一步始终设置为元素大小) 的情况下的 ndims-1 个步长的数组。如果没有指定的话,该矩阵假定为连续。
10
M
分配给构造出来的矩阵的阵列(作为一个整体或部分)。这些构造函数没有复制数据。相反,指向 m 的数据或它的子数组的头被构造并被关联到 m 上。引用计数器中无论如何都将递增。所以,当您修改矩阵的时候,自然而然就使用了这种构造函数,您还修改 m 中的对应元素。如果你想要独立的子数组的副本,请使用 Mat::clone()
11
img
指向老版本的 IplImage 图像结构的指针。默认情况下,原始图像和新矩阵之间共享数据。但当 copyData 被设置时,完整的图像数据副本就创建起来了
12
vec
矩阵的元素构成的 STL 向量。矩阵可以取出单独一列并且该列上的行数和矢量元素的数目相同。矩阵的类型匹配的向量元素的类型。构造函数可以处理任意的有正确声明的 DataType 类型。这意味着矢量元素不支持的混合型结构,它们必须是数据( numbers )原始数字或单型数值元组。对应的构造函数是显式的。由于 STL 向量不会自动转换为 Mat 实例,您应显式编写 Mat(vec) 。除非您将数据复制到矩阵 ( copyData = true ),没有新的元素被添加到向量中,因为这样可能会造成矢量数据重新分配,并且因此使得矩阵的数据指针无效
13
copyData
指定 STL 向量或旧型 CvMat 或 IplImage 是应复制到 (true) 新构造的矩阵中 还是 (false) 与之共享基础数据的标志,复制数据时,使用 Mat 引用计数机制管理所分配的缓冲区。虽然数据共享的引用计数为 NULL ,但是分配数据必须在矩阵被析构之后才可以释放
14
rowRange
m 的行数的取值范围。正常情况下,范围开始端具有包容性和范围结束端是独占的。使用 Range::all() 来取所有的行。
15
colRange
m 列数的取值范围。使用 Range::all() 来取所有的列
16
ranges
表示 M 沿每个维度选定的区域的数组
17
expr
矩阵表达式。请参见 “矩阵表达式”一节的内容
以上这些都是 Mat 形成一个矩阵的各类构造函数。如输出数据的自动分配中所提到的,往往默认构造函数就足够了,不同的矩阵可以由 OpenCV 函数来分配数据空间。构造的矩阵可以进一步分配给另一个矩阵或矩阵表达或通过 Mat::create() 获配。在前一种情况,旧的内容是间接引用的。
Mat_<uchar> 对应的是 CV_8U ,
Mat_<char> 对应的是 CV_8S ,
Mat_<int> 对应的是 CV_32S ,
Mat_<float> 对应的是 CV_32F ,
Mat_<double> 对应的是 CV_64F ,对应的数据深度如下:
• CV_8U-8 位无符号整数 ( 0 … ..255 )
• CV_8S-8 位符号整数 ( -128 … ..127 )
• CV_16U-16 位无符号整数 ( 0 …… 65535 )
• CV_16S-16 位符号整数 ( -32768 … ..32767 )
• CV_32S-32 位符号整数 ( -2147483648 …… 2147483647 )
• CV_32F-32 位浮点数 ( -FLT_MAX ……… FLT_MAX , INF , NAN)
• CV_64F-64 位浮点数( -DBL_MAX ……… .DBL_MAX , INF , NAN)
要少使用 CV_64F ,但是 vs 的编译器又会把 float 数据自动变成 double 型,有些不太爽。
还有个需要注意的问题,就是流操作符 << 对于 Mat 的操作,仅限于 Mat 是 2 维的情况。
还有必要说一下 Mat 的存储是逐行的存储的。
再说说 Mat 的创建,方式有两种,罗列一下:
1. 调用 create (行,列,类型)
2. Mat (行,列,类型(值))。
成员函数详细说明
在 Mat 类中有着众多的成员函数,后面会对所有成员函数进行详细的功能解读。
Mat row(int y)
获取 y 列数据。
Mat col(int x) const
获取 x 值。
Mat rowRange(int startrow, int endrow) const
获取起始列和结束列区域的数据
Mat rowRange(const Range& r) const
用 r 内的数据设定起始和结束列
Mat colRange(int startcol, int endcol) const
获取行数据,其余同上
Mat colRange(const Range& r) const
获取行数据,其余同上
Mat diag(int d=0) const
获取对角线数据:
d = 0 :全图对角线
d > 0 :下帮部分对角线数据
d < 0 :上半部分对角线数据
Mat clone() const
创建数据副本。
与 Mat1 = Mat2 不同, Mat2 被清除后 Mat1 数据也会被清除。
Mat1 = Mat2.clone() 在 Mat2 被改变后 Mat1 不会被改变
void copyTo( OutputArray m ) const;
复制数据到 m 中
void copyTo( OutputArray m, InputArray mask ) const;
复制 mask 设定的部分数据到 m 中
void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const;
转换矩阵存储类型,具体计算公式如下:
m(x,y)=saturate_cast<rType>( α ( ∗ this)(x,y)+ β )
m 是输入矩阵, rtype 是目标类型, alpha 是放缩系数, beta 是增减标量。
这个函数也至关重要,因为在数字图像处理中,矩阵是最基本的运算单位,而矩阵的数 据类型转换全靠该函数来实现。
void assignTo( Mat& m, int type=-1 ) const
功能同上,将数据转换到 M 矩阵中, type 设定目标数据
Mat& operator = (const Scalar& s)
设置矩阵的所有像素点值为 s 。
Mat& setTo(InputArray value, InputArray mask=noArray())
设定矩阵中部分区域的值为 value
Mat reshape(int cn, int rows=0) const;
改变通道数和行数或其中之一:
cn – 新的通道数。若 cn=0 ,那么通道数就保持不变。
rows –新的行数。 若 rows = 0, 那么行数保持不变
Mat reshape(int cn, int newndims, const int* newsz) const
改变通道数和数据维数或其中之一:
cn – 新的通道数。若 cn=0 ,那么通道数就保持不变。
newndims – 新的维数。 若 = 0, 那么维数保持不变。
newsz – 新维平面的尺寸。
MatExpr t() const;
获取转置矩阵。
MatExpr inv(int method=DECOMP_LU) const;
获取逆矩阵:
– DECOMP_LU 是 LU 分解一定不能是单数的。
– DECOMP_CHOLESKY 是 Cholesky LLT 只适用于对称正矩阵的分解。该类型在处理大的矩阵时的速度是 LU 的两倍左右。
– DECOMP_SVD 是 SVD 分解。如果矩阵是单数或甚至不是 2 维,函数就会计算伪反转矩阵。
MatExpr mul(InputArray m, double scale=1) const
矩阵按元素进行乘法运算
Mat cross(InputArray m) const;
矩阵差乘
Mat dot(InputArray m) const;
矩阵点乘
static MatExpr zeros(int rows, int cols, int type);
static MatExpr zeros(Size size, int type);
static MatExpr zeros(int ndims, const int* sz, int type);
设置 0 矩阵
static MatExpr ones(int rows, int cols, int type);
static MatExpr ones(Size size, int type);
static MatExpr ones(int ndims, const int* sz, int type);
设置 1 矩阵
static MatExpr eye(int rows, int cols, int type);
static MatExpr eye(Size size, int type);
设置对角线维 1 的矩阵
void create(int rows, int cols, int type);
void create(Size size, int type);
void create(int ndims, const int* sizes, int type);
设置类型中的变量数据
void addref();
refcount; 成员变量自加一
该方法递增与矩阵数据关联的引用计数。如果矩阵头指向外部的数据集(见 Mat::Mat() ),则引用计数为 NULL ,并且该方法在这种情况下不起作用。通常情况下,为避免内存泄漏,不应显式调用该方法。它是由该矩阵赋值运算符隐式调用。在支持的它平台上,引用计数器递增是一个原子操作。因此,对相同的矩阵,在不同的线程异步操作是安全的。
void release();
在必要的情况下,递减引用计数并释放该矩阵。
该方法递减与矩阵的数据关联的引用计数。当引用计数减为 0 时,矩阵的数据将被释放,数据和引用计数器指针设置为 NULL 。如果矩阵头指向外部数据集 (见 Mat::Mat() ), 引用计数为 NULL ,并且该方法在这种情况下无效。
可以手动调用此方法强制矩阵数据释放。但由于这种方法在析构函数中是自动调用的, 或以更改数据指针的其他方法,因此通常不需要调用这个函数。在支持它的平台上,引用计 数器递减并检查是否为 0 是一个原子操作。因此,在不同的线程异步调用相同的矩阵是安 全的操作。
void resize(size_t sz);
void resize(size_t sz, const Scalar& s);
调整 Mat 尺寸, sz :新增加行列数量
s :新增行列数据值
void reserve(size_t sz);
调整 Mat 到只有 sz 的行列尺寸
void push_back_(const void* elem);
void push_back(const Mat& m)
elem –增加的一个或多个元素。 m –增加的一个 Mat
该方法将一个或多个元素添加到矩阵的底部。他们是模拟相应的 STL 向量类的方法。
元素为 Mat 时,其类型和列的数目必须和矩阵容器是相同的。
void pop_back(size_t nelems=1);
nelems –删除的行的数目。如果它大于总的行数,则会引发异常。
该方法从底部的列表中删除一行或多行。
void locateROI( Size& wholeSize, Point& ofs ) const;
父矩阵内定位矩阵头。
wholeSize –输出参数,其中包含的整个矩阵包含大小 * 这是其中一部分。 ofs –输出参数包含 *this 在整个的矩阵里面的偏移量。你使用 Mat::row() 、 Mat::col() 、 Mat::rowRange() 、 Mat::colRange() 以及其他的方法从矩阵中提取子阵后该结果子阵只指向 原始大矩阵的一部分。然而,每个子阵包含有助于重建的最初矩阵大小和提取子阵在原始矩 阵中的位置信息(由 datastart 和 dataend fi elds 表示)。 locateROI 方法正是这样做的。
Mat& adjustROI( int dtop, int dbottom, int dleft, int dright );
调整子阵大小及其在父矩阵中的位置。
dtop –顶部子阵边界向上的平移量。
dbottom –底部子阵边界向下的平移量。
dleft –左子阵边界向左的平移量。
dright –右子阵边界向右的平移量。
该方法是 Mat::locateROI() 的互补性方法。这些函数的典型应用是确定父矩阵中子阵的位置,然后以某种方式改变位置。尤其典型的是,当滤镜操作中要考虑 ROI 外的像素时就需要它。当方法的所有参数都是正的时候, ROI 需要以指定量全方位增长,例如:
A.adjustROI(2, 2, 2,2);
在此示例中,每个方向 4 元素增加矩阵大小。矩阵向左侧和上侧分别平移 2 个元素, 这会产生 5 x 5 内核的滤镜所需的所有像素。你的责任是确保 adjustROI 不超出父矩阵边 界。如果超出,该函数发出错误提示。 OpenCV 的滤镜函数在内部调用该函数,像 filter2D() , 形态学的操作,等等。
Mat operator()( Range rowRange, Range colRange ) const;
Mat operator()( const Rect& roi ) const;
Mat operator()( const Range* ranges ) const;
提取矩形子阵
rowRange –提取的子阵的开始和结束的行。不包括的上限。若要选择的所有行,请使 用 Range::all() 。
colRange –提取的子阵的开始和结束的列。不包括的上限。若要选择的所有列,请使用 Range::all() 。
roi – 抽出子阵 speci fi ed 作为一个矩形。
ranges – 选定范围沿每个数组维度的数组。
该运算符为 *this 的子数组创建新的头。他们是 Mat::row() 、 Mat::col() 、 Mat::rowRange() , 和 Mat::colRange() 最普遍的形式。例如, A(Range(0, 10),Range::all()) 是相当于 A.rowRange(0, 10) 。与上述所有操作相同,该操作运算符是复杂度为 O(1) 的操作,就是没有矩阵数据将被 复制。
bool isContinuous() const;
返回矩阵是否连续。
//! returns true if the matrix is a submatrix of another matrix
bool isSubmatrix() const;
返回矩阵是否子矩阵。
size_t elemSize() const;
返回矩阵元素大小 (以字节为单位)。
该方法返回以字节为单位的矩阵元素大小。例如,如果矩阵类型是 CV_16SC3 ,该方法返回 3*sizeof(short) 或 6 。
size_t elemSize1() const;
以字节为单位返回每个矩阵元素通道的大小。
该方法返回以字节为单位的矩阵元素通道大小,也就是忽略通道的数量。例如,如果矩阵类型是 CV_16SC3 ,该方法返回 sizeof(short) 或 2 。
int type() const;
返回一个矩阵元素的类型。
int depth() const;
返回一个矩阵元素的深度。
• CV_8U-8 位无符号整数 ( 0 … ..255 )
• CV_8S-8 位符号整数 ( -128 … ..127 )
• CV_16U-16 位无符号整数 ( 0 …… 65535 )
• CV_16S-16 位符号整数 ( -32768 … ..32767 )
• CV_32S-32 位符号整数 ( -2147483648 …… 2147483647 )
• CV_32F-32 位浮点数 ( -FLT_MAX ……… FLT_MAX , INF , NAN)
• CV_64F-64 位浮点数( -DBL_MAX ……… .DBL_MAX , INF , NAN)
int channels() const;
返回矩阵通道的数目。
size_t step1(int i=0) const;
返回矩阵归一化迈出的一步。
该方法返回以矩阵的 step 除以 Mat::elemSize1() 。它对快速访问任意矩阵元素很有用。
bool empty() const;
如果数组有没有 elemens ,则返回 true 。
size_t total() const;
返回数组元素的总数。
uchar* ptr(int i0=0);
const uchar* ptr(int i0=0) const;
返回指定矩阵行的指针。
uchar* ptr(int i0, int i1);
const uchar* ptr(int i0, int i1) const;
返回指定二维矩阵行指针
uchar* ptr(int i0, int i1, int i2);
const uchar* ptr(int i0, int i1, int i2) const;
返回指定三维矩阵的行指针
uchar* ptr(const int* idx);
返回矩阵元素的指针
const uchar* ptr(const int* idx) const;
返回到矩阵元素的只读指针
template<typename T> T& Mat::at(int i)const
template<typename T> const T&Mat::at(int i) const
template<typename T> T& Mat::at(int i,int j)
template<typename T> const T&Mat::at(int i, int j) const
template<typename T> T& Mat::at(Pointpt)
template<typename T> const T&Mat::at(Point pt) const
template<typename T> T& Mat::at(int i,int j, int k)
template<typename T> const T&Mat::at(int i, int j, int k) const
template<typename T> T& Mat::at(constint* idx)
template<typename T> const T&Mat::at(const int* idx) const
返回对指定数组元素
i –索引 0 维度
j – 1 维度的索引
k – 沿 2 维度的索引
pt – Point(j,i) 作为指定元素的位置。
idx – Mat::dims 数组的索引。
该模板方法返回指定数组元素的引用。为了具有更高的性能,索引范围检查只在调试配 置下执行。请注意使用具有单个索引 (i) 的变量可以访问的单行或单列的 2 维的数组元素。 也就是比 方说,如果 A 是 1 x N 浮点矩阵 和 B 是 M x 1 的整数矩 阵,您只需编 写 A. at<float>(k+4) 和 B.at<int>(2*i+1) 分别代替 A.at<float>(0,k+4) 和 B.at<int>(2*i+1,0) 。
template<typename _Tp>MatIterator_<_Tp> Mat::begin()
template<typename _Tp>MatConstIterator_<_Tp> Mat::begin() const
返回矩阵迭代器,并将其设置为第一矩阵元。
该方法返回矩阵的只读或读写的迭代器。矩阵迭代器的使用和双向 STL 迭代器的使用
是非常相似的。
template<typename _Tp>MatIterator_<_Tp> Mat::end()
template<typename _Tp>MatConstIterator_<_Tp> Mat::end() const
返回矩阵迭代器,并将其设置为 最后元素之后( after-last )的矩阵元。
该方法返回矩阵只读或读写的迭代器,设置为紧随最后一个矩阵元素的点。
Mat 类成员
Mat 类成员名称的含义:
序号
类名称
含义
1
allocator
如果需要创建一个新矩阵的内存空间,系统会调用 MatAllocator 类作为分配符进行内存的分配
2
cols
图像数组的列数
3
data
图像数据指针
4
dataend
图像 ROI 数据结束地址
5
datalimit
图像 ROI 实时数据地址
6
datastart
图像 ROI 数据起始地址
7
dims
图像数组的维度
8
flags
数据是非连续的标志位
9
refcount
它记录了这个矩阵的数据被其他变量引用了多少次
10
rows
图像数组的行数
11
size
返回一个矩阵大小
12
step
矩阵元素寻址。 step[i] 是 Mat 类中十分重要的一个属性,表示第 i 维的总大小,单位字节 .
其他说明:
int* refcount : 【二次开发的关键】
它记录了这个矩阵的数据被其他变量引用了多少次。在 c++ 中矩阵的一些赋值操作往往 只给新的变量赋予一个新的头文件,而数据部分只把数据指针指过去,而不重新分为内存, 需要程序员来管理内存。这样的话就会有隐患,因为如果原始的变量的数据内存释放了,新 的变量却还在,指向了已经被释放的内存区域,如果对新变量进行操作,很可能出现意想不 到的问题。不过不用担心,OpenCV 的开发者早就想到了这个问题,并为我们想到了一个解 决方法,那就是靠这个 refcount 来记录该数据被多少变量共用,直到最后一个变量被释放 时,才释放掉这个存储数据内存块。这也是为什么类定义中 refcount 为指针,让实际记录 次数的变量跟在矩阵数据最后面。
保存图像像素数据的矩阵则会随着图像的大小而改变,通常数据量会很大,比矩阵头大 几个数量级。这样,在图像复制和传递过程中,主要的开销是由存放图像像素的矩阵而引起 的。因此,OpenCV 使用了引用次数,当进行图像复制和传递时,不再复制整个 Mat 数据, 而只是复制矩阵头和指向像素矩阵的指针,但是其矩阵指针指向同一个矩阵,也就是其中任何一个改变了矩阵数据都会影响另外一个。
这就是引用计数的作用,当 Mat 对象每被复制一次时,就会将引用计数加 1 ,而每销毁一个 Mat 对象(共用同一个矩阵数据)时引用计数会被减 1 ,当引用计数为 0 时,矩阵数据会被清理。这就是 refcount 的作用。
构造函数
空构造
Mat()
构造空的类,结构体全零初始化。
2D 平面构造
Mat(int rows, int cols, int type)
构造 cols 行, rows 列,数据类型为 type 的类
Mat(int rows, int cols, int type, const Scalar& s);
构造内容同上,增加了预装填数据 s
Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP);
构造内容同上,使用 data 指针指向数据进行初始化装填。
Mat(Size size, int type)
构造行列数量为 size 内装填值的 type 类型的类
Mat(Size size, int type, const Scalar& s);
构造内容同上,增加了预装填数据 s
Mat(Size size, int type, void* data, size_t step=AUTO_STEP);
构造内容同上,使用 data 指针指向数据进行初始化装填。
//! constructor for matrix headers pointing to user-allocated data
nD 矩阵构建
Mat(int ndims, const int* sizes, int type);
构建带有 ndims 个 2D 平面的,大小存储在地址中的, type 类型数据矩阵类
Mat(int ndims, const int* sizes, int type, const Scalar& s);
构造内容同上,增加了预装填数据 s
Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0);
构造内容同上,使用 data 指针指向数据进行初始化装填。
使用 Mat 进行初始化
Mat(const Mat& m);
复制已有的 Mat ,构造一个新的 Mat 。其中所有的值都和已有的 Mat 相同。
Mat(const Mat& m, const Range& rowRange, const Range& colRange);
复制已有 Mat 的部分列( rowRange ),部分行( colRange )构建一个新的 Mat 类。
Mat(const Mat& m, const Rect& roi);
复制由 Roi 框选的已有 Mat 类部分数据,构建一个新的类
Mat(const Mat& m, const Range* ranges);
复制 Mat 类总被 ranges 指针指向数据规定的范围数据,构建一个新的 Mat 。
CvMat 格式数据初始化 Mat
Mat(const CvMat* m, bool copyData=false);
C 语言格式数据 CvMat 来构造新的 2D 格式的 Mat 类,根据 copyData 判定是否复制数据。
Mat(const CvMatND* m, bool copyData=false);
C 语言格式数据 CvMatND 来构造新的 ND 格式的 Mat 类,根据 copyData 判定是否复制数据。
Mat(const IplImage* img, bool copyData=false);
使用 OpenCV1.0 格式下最根本的图像数据存储结构体 IplImage 来构造新的 2D 格式的 Mat 类,根据 copyData 判定是否复制数据。