qq_34614890
betterhalf
采纳率15.4%
2016-05-06 03:45 阅读 1.3k

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

#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条回答 默认 最新

  • qq_34614890 betterhalf 2016-05-06 04:51

    在线等啊来人啊
    啊啊

    点赞 评论 复制链接分享

相关推荐