2017년 4월 26일 수요일

수업자료_invert

size(600,400);
background(255);
PImage img=loadImage("01.jpg");
image(img,0,0);

loadPixels();
for(int i=0; i<(width*height); i++){
  int r=abs(int(red(pixels[i]))-255);
  int g=abs(int(green(pixels[i]))-255);
  int b=abs(int(blue(pixels[i]))-255);
  int a=int(alpha(pixels[i]));
 
  pixels[i]=color(r,g,b,a);
}
updatePixels();



댓글 없음:

댓글 쓰기

아두이노와 프로세싱 연동: 가변저항으로 프로세싱 색상제어

아두이노와 프로세싱을 연동하는 프로젝트로서, 아두이노의 가변저항을 조절하여 프로세싱의 rect의 색상을 조절해봅니다. 과정은 간단합니다.  1. 아두이노보드에 가변저항을 연결합니다. 가변저항의 세 단자에 GND, 5V, 그리고 A0(아날로...