• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Real timeimageprocessing
 

Real timeimageprocessing

on

  • 737 views

 

Statistics

Views

Total Views
737
Views on SlideShare
737
Embed Views
0

Actions

Likes
1
Downloads
2
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Real timeimageprocessing Real timeimageprocessing Presentation Transcript

    • Real Time Image Processing with OpenGL ES 2.013年3月24日日曜日
    • カメラ OpenGL ES テクスチャ Custom Fragment Shader CAEAGLLayer UIView13年3月24日日曜日
    • カメラ OpenGL ES テクスチャ Custom Fragment Shader ・爆速(GPU) ・多彩な表現 CAEAGLLayer ・無限の自由度 UIView13年3月24日日曜日
    • Fragment Shaderって何だよ(怒 よくある画像処理プログラミング const int wide = 100; const int high = 100; unsigned char pixels[wide * high * 4] = {0}; for(int y = 0 ; y < high ; ++y) { for(int x = 0 ; x < wide ; ++x) { unsigned char *color = pixels + 4 * (y * wide + x); color[0] = 32; color[1] = 12; color[2] = 0; color[3] = 120; } }13年3月24日日曜日
    • Fragment Shaderって何だよ(怒 const int wide = 100; const int high = 100; unsigned char pixels[wide * high * 4] = {0}; for(int y = 0 ; y < high ; ++y) { for(int x = 0 ; x < wide ; ++x) { Fragment Shader! } }13年3月24日日曜日
    • Basics 浮動小数点精度 precision highp float; uniform sampler2D videoInput; ユーザー定義定数 uniform float iGlobalTime; uniform vec2 iResolution; varying highp vec2 uv; void main() { vec2 unused1 = iResolution; float unused2 = iGlobalTime; gl_FragColor = texture2D(videoInput, uv); } 出力色 画像 座標13年3月24日日曜日
    • precision highp float; uniform sampler2D videoInput; uniform float iGlobalTime; uniform vec2 iResolution; varying vec2 uv; void main() { vec2 unused = iResolution; float stongth = sin(iGlobalTime) * 0.5 + 0.5; float waveu = sin((uv.y + iGlobalTime) * 20.0) * 0.5 * 0.1 * stongth; gl_FragColor = texture2D(videoInput, uv + vec2(waveu, 0)); }13年3月24日日曜日
    • precision highp float; uniform sampler2D videoInput; uniform float iGlobalTime; uniform vec2 iResolution; varying vec2 uv; void main(void) { vec2 unused = iResolution; float blurx = sin(iGlobalTime) * 0.5 + 0.5; float offsetx = blurx * 0.05; vec2 ruv = uv + vec2(offsetx, 0.0); vec2 guv = uv; vec2 buv = uv - vec2(offsetx, 0.0); float r = texture2D(videoInput, ruv).r; float g = texture2D(videoInput, guv).g; float b = texture2D(videoInput, buv).b; gl_FragColor = vec4(r, g, b, 1.0); }13年3月24日日曜日
    • precision highp float; uniform sampler2D videoInput; uniform float iGlobalTime; uniform vec2 iResolution; varying vec2 uv; float gray(vec4 color) { return (color.r + color.g + color.b) * 0.33333333; } void main(void) { float unused = iGlobalTime; float pixelwide = 1.0 / iResolution.x; float pixelhigh = 1.0 / iResolution.y; vec4 c = texture2D(videoInput, uv); float c_value = gray(c); vec4 l = texture2D(videoInput, uv + vec2(-pixelwide, 0.0)); vec4 u = texture2D(videoInput, uv + vec2(0.0, pixelhigh)); vec4 r = texture2D(videoInput, uv + vec2( pixelwide, 0.0)); vec4 b = texture2D(videoInput, uv + vec2(0.0, -pixelhigh)); float difference = 0.0; difference = max(difference, abs(c_value - gray(l))); difference = max(difference, abs(c_value - gray(u))); difference = max(difference, abs(c_value - gray(r))); difference = max(difference, abs(c_value - gray(b))); difference = clamp(difference * 20.0, 0.0, 1.0); gl_FragColor = vec4(difference, difference, difference, 1.0); }13年3月24日日曜日
    • Enjoy Shader! https://github.com/Ushio/RealTimeImageProcessing13年3月24日日曜日