mergeImg=cvCloneImage(frame);
for (int y=21; y<175; y++) {
uchar* ptr2=(uchar*) (logoImg->imageData +y*logoImg->widthStep);
uchar* ptr1=(uchar*) (mergeImg->imageData +(y+y1)*mergeImg->widthStep);
for (int x=15; x<220; x++) {
int R,G,B;
if(ptr2[3*(x+x1)]>=240 && ptr2[3*(x+x1)+1]>=240 && ptr2[3*(x+x1)+2]>=240){
ptr2[3*(x+x1)]=ptr1[3*(x+x1)];
ptr2[3*(x+x1)+1]=ptr1[3*(x+x1)+1];
ptr2[3*(x+x1)+2]=ptr1[3*(x+x1)+2];
if(x<110&&y<87){
R=255;G=0;B=0;}
if(x>110&&y<87){
R=255;G=255;B=128;}
if(x<110&&y>87){
R=255;G=255;B=128;}
if(x>110&&y>87){
R=255;G=0;B=0;}
if( ptr2[3*(x+x1)]<=130 && ptr2[3*(x+x1)+1]<=130 && ptr2[3*(x+x1)+2]<=130){
ptr2[3*(x+x1)]=B;
ptr2[3*(x+x1)+1]=G;
ptr2[3*(x+x1)+2]=R;
}
}
}
}
透明!
mergeImg=cvCloneImage(frame);
for (int y=0; y<logoImg->height; y++) {
uchar* ptr2=(uchar*) (logoImg->imageData +y*logoImg->widthStep);
uchar* ptr1=(uchar*) (mergeImg->imageData +(y+y1)*mergeImg->widthStep);
for (int x=0; x<logoImg->width; x++) {
int R,G,B;
if(ptr1[3*(x+x1)]>=110 && ptr1[3*(x+x1)+1]>=110 && ptr1[3*(x+x1)+2]>=110){
ptr2[3*(x+x1)]=ptr1[3*(x+x1)];
ptr2[3*(x+x1)+1]=ptr1[3*(x+x1)+1];
ptr2[3*(x+x1)+2]=ptr1[3*(x+x1)+2];
}
}
沒有留言:
張貼留言