图像截取:
IplImage *src1 = cvGetImage(cvGetSubRect(src, cvCreateMatHeader(width,height, CV_8UC1), cvRect(pointX, pointY, width,height)), cvCreateImageHeader(cvSize(width,height), 8, 1));//截取起始点:(pointX, pointY),截取宽度:width,截取长度:height
图像合并:
//将图像img1,img2()合并为img,
IplImage* img=cvCreateImage(cvSize(img1->width+img2->width,img1->height+img2->height),img1->depth,img1->channels);
CvRect rect=cvRect(0,0,img1->width,img1->height);
cvSetImageROI(img,rect);//设置图像感兴趣区域
cvCopy(img1,img);
cvResetImageROI(img);
rect=cvRect(img1->width,0,img2->width,img2->height);
cvSetImageROI(img,rect);
cvCopy(img2,img);
cvResetImageROI(img);
图像反色:
cvXorS(img, cvScalarAll(255), img);
图像求canny边缘:
IplImage* src;
src=cvLoadImage(“路径”,1);//读取彩色图
//-------canny
【opencv】图像截取、合并、反色、canny边缘、二值化
最新推荐文章于 2024-06-17 13:25:41 发布