跳转到内容

File:Rolling shutter effect animation.gif

页面内容不支持其他语言。
這個文件來自維基共享資源
维基百科,自由的百科全书

Rolling_shutter_effect_animation.gif (400 × 200像素,文件大小:139 KB,MIME类型:image/gif、​循环、​60帧、​6.0秒)


摘要

描述
English: The effect of a rolling shutter on a spinning disc simulated. The jagged appearance is due to the small number of rows; the higher number of rows in a real camera results in smoother curves.
日期
来源
Rolling shutter effect.svg
作者 cmglee

Python source

The frames were rendered using Python 2 with pypng below, converted to GIF, made into a GIF animation, and optimised with Ezgif.

#!/usr/bin/env python
import png, math, os, functools, operator

def draw_pixel(pixelsss, x, y, rrggbb):
 pixelsss[y][x][0] = int(rrggbb[-6:-4], 16)
 pixelsss[y][x][1] = int(rrggbb[-4:-2], 16)
 pixelsss[y][x][2] = int(rrggbb[-2:  ], 16)
def write_png(path, pixelsss, width, height=None, alpha=False):
 print('> %s' % (path))
 f_out = png.Writer(width=width, height=width if height is None else height, alpha=alpha)
 return f_out.write_array(open(path, 'wb'),
         functools.reduce(operator.iconcat,
         functools.reduce(operator.iconcat, pixelsss, []), []))
def compute_colour(fraction, deg):
 return colours[int((deg + 720 - 360 * fraction + 0.5) / 60) % 6]

n_frame  = 60
w_frame  = 400
h_frame  = 200
radius   = 99
w_frame2 = w_frame // 2
diameter = radius  *  2
colours  = ['ff0000','cc9900','00cc00','3399ff','6666ff','cc33ff']
basename = os.path.splitext(os.path.basename(__file__))[0]
cumulsss = [[[255 for c in range(3)] for x in range(diameter)]
                                     for y in range(diameter)]
for i_frame in range(n_frame + 1): ## 0 = prepare cumulative image
 framesss = [[[255 for c in range(3)] for x in range(w_frame)]
                                      for y in range(h_frame)]
 for y in range(-radius, radius):
  out_y     = y + radius
  out_y_end = (diameter - 1) * i_frame // n_frame
  for x in range(-radius, radius):
   if x * x + y * y < radius * radius:
    out_x = x + radius
    deg   = math.degrees(math.atan2(y, x))
    colour_cumul = compute_colour((y + radius + 1.0) / (diameter - 1), deg)
    colour_disc  = compute_colour(float(i_frame)     / n_frame       , deg)
    if i_frame > 0: draw_pixel(framesss, out_x + 1, out_y, colour_disc )
    else:           draw_pixel(cumulsss, out_x    , out_y, colour_cumul)
  if out_y <= out_y_end: framesss[out_y][w_frame2:w_frame2 + diameter] = cumulsss[out_y]
  for dy in [-1, 0]:
   framesss[out_y_end + dy][1] = framesss[out_y_end + dy][w_frame - 2] = [0,0,0]
  for dy in [-2, 1]:
   framesss[out_y_end + dy][1:w_frame - 1] = [[0,0,0] for i in range(w_frame - 2)]
 if i_frame > 0:
  write_png(r'F:\%s\%02d.png'  % (basename, i_frame), framesss, w_frame, h_frame)
 else:
  write_png(r'F:\%s\00.png' % (basename), cumulsss, diameter, diameter)

许可协议

w:zh:知识共享
署名 相同方式共享
您可以自由地:
  • 共享 – 复制、发行并传播本作品
  • 修改 – 改编作品
惟须遵守下列条件:
  • 署名 – 您必须对作品进行署名,提供授权条款的链接,并说明是否对原始内容进行了更改。您可以用任何合理的方式来署名,但不得以任何方式表明许可人认可您或您的使用。
  • 相同方式共享 – 如果您再混合、转换或者基于本作品进行创作,您必须以与原先许可协议相同或相兼容的许可协议分发您贡献的作品。

说明

添加一行文字以描述该文件所表现的内容

此文件中描述的项目

描繪內容

文件历史

点击某个日期/时间查看对应时刻的文件。

日期/时间缩⁠略⁠图大小用户备注
当前2025年5月23日 (五) 02:282025年5月23日 (五) 02:28版本的缩略图400 × 200​(139 KB)CmgleeIncrease framerate to 10 fps
2025年5月23日 (五) 02:042025年5月23日 (五) 02:04版本的缩略图400 × 200​(56 KB)CmgleeCalculate every row in Python with png.py to reduce jaggies
2013年10月16日 (三) 17:342013年10月16日 (三) 17:34版本的缩略图400 × 200​(109 KB)CmgleeUser created page with UploadWizard

以下页面使用本文件:

全域文件用途

以下其他wiki使用此文件:

元数据