python Data Analysis and Visualization – Week One/Unit Three/Eg 1: Hand Drawing Effect

中文版本: https://today2tmr.com/2017/08/29/图像的手绘效果/

Image Representation with Array

  • RGB,each pixel is combined by red, green and blue
  • Range is 0-255

PIL

  • Python Image Library
  • pip install pillow
  • from PIL import Image
  • Imageis a basic class. One instance means one image.
  • Image is two dimensional matrix, each element is RGB value

  • Three dimensional array, height, width and RGB value

Transformation of Images

  • Read image, obtain RGB, then change and save as new file.
  • Image.open()
  • Image.fromarray()
  • convert('L'):  turn to grey image

 

 

 

Analysis of Hand Drawing Effect Example

  • I don’t understand the algorithm clearly…So I convey it directly ( lazy..
  • Black and white, or grey
  • Strong border lines
  • The same color is to tend toward white
  • Slightly light source effect

Refactor of Gradient

  • Use gradient and virtual depth value to refactor image
  • Gradient——light and shade
  • stereoeffect——add virtual depth value

One Reply to “python Data Analysis and Visualization – Week One/Unit Three/Eg 1: Hand Drawing Effect”

Leave a Reply

Your email address will not be published.