哪里有错误,求指正;哪里有错误,求指正

#include
#include
#include

using namespace std;

int main(IplImage* src, IplImage* dst)
{

src = cvLoadImage("1.JPG", 0);
dst = cvLoadImage("2.JPG", 0);
cvShowImage("src", src);
cvShowImage("dst", dst);
dst = cvCreateImage(cvSize(dst->width, dst->height),dst->depth, 1);








cvNamedWindow("image1", 1);
cvShowImage("image1", dst);
cvWaitKey(0);
cvReleaseImage(&src);
cvReleaseImage(&dst);
cvDestroyAllWindows();
return 0;

}

bool imageSubtract(IplImage* src, IplImage* dst)
{
int row = 0;//行
int col = 0;//列
uchar* pSrcData = NULL;
uchar* pDstData = NULL;
int stepSrc = 0;
int stepDst = 0;

if (!src || !dst)
{
    return 0;
}
if ((src->height != dst->height) && (src->width != dst->width))
{
    return 0;
}

pSrcData = (uchar *)src->imageData;
stepSrc = src->widthStep / sizeof(uchar);

pDstData = (uchar *)src->imageData;
stepDst = dst->widthStep / sizeof(uchar);

for (row = 0;row <src->height;row++)
{
    for (col = 0;col<src->width;col++)
    {
        pDstData[row*stepDst + col] = abs(pSrcData[row*stepSrc + col] - pDstData[row*stepDst + col]);
    }
}
return 1;

}

1个回答

在线等啊来人啊
啊啊

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐