#include<cv.h>
#include<iostream>
using namespace std;
using namespace cv;
int main()
{
IplImage *img= cvLoadImage("bayer_test.tif",-1);
cvNamedWindow("org");
cvShowImage("org",img);
IplImage *imgdst = cvCreateImage(cvSize(img->width,img->height),IPL_DEPTH_8U,3);
cout<<imgdst->widthStep<<endl;
for( int i=0; i<720;i++)
{
for(int j=0; j<1280; j++)
{
((uchar*)(imgdst->imageData + i*img->widthStep))[j] =(img->imageData+i*img->widthStep)[j];
}
}
cvNamedWindow("dst");
cvShowImage("dst",imgdst);
cvWaitKey();
}
源图像的格式时 单通道 1280*712,输出图像的格式位三通到 1280*3. 源图像每一行的字节数时1280个(因为1280个像素点),我想问下三通到每一行的字节数是不是1280*3
如果是的话 程序中 源图像的第一行像素值赋给三通到1280个值后(输出图像的部长我用的是源图像img->imgstep),源图像的第二行像素值不应该接着赋给三通1280以后的像素值吗。为啥显示出来的是这个效果。