跳至內容

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:創用CC
姓名標示 相同方式分享
您可以自由:
  • 分享 – 複製、發佈和傳播本作品
  • 重新修改 – 創作演繹作品
惟需遵照下列條件:
  • 姓名標示 – 您必須指名出正確的製作者,和提供授權條款的連結,以及表示是否有對內容上做出變更。您可以用任何合理的方式來行動,但不得以任何方式表明授權條款是對您許可或是由您所使用。
  • 相同方式分享 – 若要根據本素材進行再混合、轉換或創作,則必須以與原作相同或相容的授權來發布您的作品。

說明

添加單行說明來描述出檔案所代表的內容

在此檔案描寫的項目

描繪內容

檔案歷史

點選日期/時間以檢視該時間的檔案版本。

日期/時間縮⁠圖尺寸使用者備⁠註
目前2025年5月23日 (五) 02:28於 2025年5月23日 (五) 02:28 版本的縮圖400 × 200​(139 KB)CmgleeIncrease framerate to 10 fps
2025年5月23日 (五) 02:04於 2025年5月23日 (五) 02:04 版本的縮圖400 × 200​(56 KB)CmgleeCalculate every row in Python with png.py to reduce jaggies
2013年10月16日 (三) 17:34於 2013年10月16日 (三) 17:34 版本的縮圖400 × 200​(109 KB)CmgleeUser created page with UploadWizard

下列頁面有用到此檔案:

全域檔案使用狀況

以下其他 wiki 使用了這個檔案:

詮釋資料