首页 > 编程知识 正文

step7转成中文,linear regression

时间:2023-05-05 01:02:59 阅读:63249 作者:954

【转发】为什么opencv中widthStep不一定等于width*nChannels

opencv的图像属性widthStep属性有点奇怪,比width * nChannels稍大。 像3*3的3通道bmp图像那样,所有像素的RGB成分为97,输出如下。

图像详细参数

nSize: 112

imageSize: 36

nChannels: 3

height: 3

width: 3

widthstep: 12

979797979797979797000

979797979797979797000

979797979797979797000

可以看到在每一行之后补充了零。 将widthstep设置为4的倍数。 为什么会这样呢?

我们先来看看下面的例子。

类a

{

char a;

(;

类b

{

char a;

int b;

(;

int main () )

{

STD : cout ' sizeofa : ' sizeof (a ) std:endl;

STD : cout ' sizeofb : ' sizeof (b ) std:endl;

std:cin.get (;

返回0;

}

输出1 ) 8;

从这个例子可以看到,类中成员的内存是自动补充的,补充方式都是4的倍数。 我觉得opencv也是同样的理由。 (对齐内存)

从3http://blog.csdn.net/zhi rom/article/details/7487159转发

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。