2013年12月18日 星期三

[Image4]:Filter、Blend、Copy、Mask

Filtering 
  • Filter(BLUR,parameter):高斯模糊










  • Filter(POSTERIZE,parameter):色相分離










  • Filter(THRESHOLD,parameter):pixel value 超過門檻就變黑低於就白









  • Filter(INVERT):將每個pixel的值設成原本的inverse value










  • Filter(GRAY):變灰









  • Filter(ERODE,parameter):將亮的地方縮小









  • Filter(DILATE,parameter):將亮的地方膨脹









規則:先畫再Filter
  • line(0,30,100,60);-->BLUR
  • filter(BLUR,0.3);
  • line(0,50,100,80);

PImage類別有內建filter function
  • PImage.filter(INVERT)

Blending
從目前畫面擷取要的地方再與原圖混合
  • blend(x,y,width,height,dx,dy,dwidth,dheight,ADD)

在目前畫面中加入img,但留下兩張畫面中最暗的pixel
  • blend(PImage,x,y,width,height,dx,dy,dwidth,dheight,DARKEST)

將img2加到img中
  • img.blend(img2,x,y,width,height,dx,dy,dwidth,dheight,ADD)

顏色混合
  • c1 = color(102)
  • c2 = color(51)
  • c3 = blendColor(c1,c2,MULTIPLY)
  • red(c3)->102*51/255=20


複製目前畫面指定區域並貼上
  • copy(x,y,width,height,    cx,cy,cwidth,cheight);

將PImage 貼到目前畫面
  • copy(PImage,x,y,width,height,     cx,cy,cwidth,cheight)

PImage內建copy function
  • PImage.copy(x,y,width,height,  cx,cy,cwidth,cheight)
  • PImage.copy(PImage2,x,y,width,height,  cx,cy,cwidth,cheight)

Masking:原圖上加上一遮罩,此遮罩黑色部分擋住原圖(黑色,因為光線被擋住),遮罩白色部分讓原圖顯現(中空)

在img上加上imgMask遮罩
  • img.mask(imgMask);
Exercises
  • Load an image and alter it with filter().
  • Load three image and combine them with blend().
  • Load two image and use copy() with mouseX and mouseY to combine them in a way that reveals the relationship between the images. 

Reference
  • Casey Reas & Ben Fry : Page374






























沒有留言:

張貼留言