void DrawTransCir(IplImage* img,int x,int y,int width,int height,CvScalar color,double alpha)
{
IplImage * rec=cvCreateImage(cvSize(width,height),img->depth,img->nChannels);
rec=(IplImage*)cvClone(img);
cvCircle(rec, Point(x+width/2, y+height/2), 10, Scalar(255,0,0,0),-1);
cvSetImageROI(img,cvRect(x,y,width,height));
cvSetImageROI(rec,cvRect(x,y,width,height));
cvAddWeighted(img,alpha,rec,1-alpha,0.0,img);
cvResetImageROI(img);
cvResetImageROI(rec);
cvReleaseImage(&rec);
}
第一次写勿喷
此函数实现了在opencv里面画半透明圆形,通过设置兴趣点减少了运算了,能达到实时画图的效果。