06 Image Processing

1 Camera Filter

let capture;

function setup() {
  createCanvas(600, 500);
  capture = createCapture(VIDEO);
  capture.hide();
}

function draw() {
  image(capture, 0, 0, width, width * capture.height / capture.width);
  filter(INVERT);
}

P5Editor

Do your experiment with other filters:

  • THRESHOLD
  • GRAY
  • OPAQUE
  • INVERT
  • POSTERIZE
  • BLUR
  • ERODE
  • DILATE

You can check the reference to see how they work. Select two filters and explain them.

2 蟾宫与玉兔

“嫦娥奔月”的故事在中国广为流传。人们将嫦娥仙子在月球上所居住的宫殿称为“蟾宫”,李白曾有诗感叹嫦娥:“白兔捣药秋复春,嫦娥孤栖与谁邻?” 蟾与兔两种动物时常与月亮仙子的故事中伴随出现。大家有没有想过为什么是这两种动物,而不是其他动物呢?

使用下面的代码,探索一下是否可以在月球图片中找到“蟾蜍”与“兔子”: P5Editor

3 Image Flip

P5Editor

4 Line Game

Game Time! Pick a partner on class and make a small video of Line Game.

horizonal

vertical