
這次的變化比上次更豐富
有對影像作濾波處理
還有替圖像加入別的圖片
而且只要改變透明度
就能產生像浮水印一樣的效果
這次上課老師也讓我們自己先run一下程式
看看bug在哪裡
還有認識指標(ptr1,ptr2......)的功能
像是加入圖片在影像中時for (int x=0; xwidth; x++) { ptr2[3*(x+x1)]=alpha*ptr1[3*(x+x1)] + (1-alpha)*ptr2[3*(x+x1)]; ptr2[3*(x+x1)+1]=alpha*ptr1[3*(x+x1)+1] + (1-alpha)*ptr2[3*(x+x1)+1]; ptr2[3*(x+x1)+2]=alpha*ptr1[3*(x+x1)+2] + (1-alpha)*ptr2[3*(x+x1)+2]; } 應該改為
for (int x=0; xwidth; x++)
{
ptr2[3*(x+x1)]=alpha*ptr1[3*(x)] + (1-alpha)*ptr2[3*(x+x1)];
ptr2[3*(x+x1)+1]=alpha*ptr1[3*(x)+1] + (1-alpha)*ptr2[3*(x+x1)+1];
ptr2[3*(x+x1)+2]=alpha*ptr1[3*(x)+2] + (1-alpha)*ptr2[3*(x+x1)+2];
}
沒有留言:
張貼留言