Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
How to contribute android-gpuimage
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Yuji Koketsu
November 16, 2018
Programming
670
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How to contribute android-gpuimage
Yuji Koketsu
November 16, 2018
More Decks by Yuji Koketsu
See All by Yuji Koketsu
AutoSizingTextView
kettsun0123
0
230
Replace with dagger.android
kettsun0123
0
2.4k
Android Instant Apps or Progressive Web Apps
kettsun0123
1
490
Other Decks in Programming
See All in Programming
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
990
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
2
200
数年滞っていたダークモード対応をおよそ2週間で完了させる
chigichan24
0
690
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
180
Building an Out-of-Order CPU
latte72
1
730
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
200
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
Hono + Inertia + React で LP を構築した話
oukayuka
2
220
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
120
AIと壁打ちしながら進めるコスト管理
fufuhu
2
2k
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
180
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
890
Featured
See All Featured
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Test your architecture with Archunit
thirion
2
2.4k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
710
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
290
Typedesign – Prime Four
hannesfritz
42
3.2k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
510
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
320
Paper Plane (Part 1)
katiecoart
PRO
1
11k
Transcript
How to contribute android-gpuimage
About Me Yuji Koketsu @kettsun0123 CATS
android-gpuimageͱ GPUImage2͕ͱʹͳ͍ͬͯΔFilterΛ͔͚Δ ϥΠϒϥϦ
࣍ 1. ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. ·ͱΊ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ ࠷؆୯ͳContributeFilterΛՃ͢Δ͜ͱ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ ·ͩ·ͩFilter͕Γͳ͍
ࠓ͙͢Ͱ͖Δʂcontributeͷํ GPUImage2(iOS)ΛࢀߟʹFilterΛ࡞ͬͯPRΛग़͢
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 1. Ճ͢ΔFilterΛܾΊΔ 2. ຊՈGPUImage2ΛࢀߟʹFilterΛ࣮͢Δ 3. sampleͰ࡞ͬͨFilterΛ͑ΔΑ͏ʹ͢Δ 4. PRΛग़͢
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 1. Ճ͢ΔFilterΛܾΊΔ README͔ΒબͿ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ GPUImage2/framework/Source/Operations/Shaders
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ varying highp vec2 textureCoordinate; uniform sampler2D inputImageTexture;
uniform highp float threshold; const highp vec3 W = vec3(0.2125, 0.7154, 0.0721); void main() { highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); highp float luminance = dot(textureColor.rgb, W); highp float thresholdResult = step(luminance, threshold); highp vec3 finalColor = abs(thresholdResult - textureColor.rgb); gl_FragColor = vec4(finalColor, textureColor.w); } Operations/Shaders/Solarize_GLES.fsh
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ public static final String SOLARIZE_FRAGMENT_SHADER = ""
+ "varying highp vec2 textureCoordinate;\n" + "\n" + "uniform sampler2D inputImageTexture;\n" + "uniform highp float threshold;\n" + "\n" + "const highp vec3 W = vec3(0.2125, 0.7154, 0.0721);\n" + "\n" + "void main()\n" + "{\n" + " highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + " highp float luminance = dot(textureColor.rgb, W);\n" + " highp float thresholdResult = step(luminance, threshold);\n" + " highp vec3 finalColor = abs(thresholdResult - textureColor.rgb);\n" + " \n" + " gl_FragColor = vec4(finalColor, textureColor.w);\n" + "}"; /filter/GPUImageSolarizeFilter.java
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ public static final String SOLARIZE_FRAGMENT_SHADER = ""
+ "varying highp vec2 textureCoordinate;\n" + "\n" + "uniform sampler2D inputImageTexture;\n" + "uniform highp float threshold;\n" + "\n" + "const highp vec3 W = vec3(0.2125, 0.7154, 0.0721);\n" + "\n" + "void main()\n" + "{\n" + " highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + " highp float luminance = dot(textureColor.rgb, W);\n" + " highp float thresholdResult = step(luminance, threshold);\n" + " highp vec3 finalColor = abs(thresholdResult - textureColor.rgb);\n" + " \n" + " gl_FragColor = vec4(finalColor, textureColor.w);\n" + "}"; /filter/GPUImageSolarizeFilter.java มΛ४උ͢Δ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ /filter/GPUImageSolarizeFilter.java @Override public void onInit() { super.onInit();
uniformThresholdLocation = GLES20.glGetUniformLocation(getProgram(), "threshold"); }
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ /filter/GPUImageSolarizeFilter.java @Override public void onInitialized() { super.onInitialized();
setThreshold(threshold); } public void setThreshold(final float threshold) { this.threshold = threshold; setFloat(uniformThresholdLocation, threshold); } ֎෦͔ΒΛͤΔΑ͏ʹ͢Δ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ sample/GPUImageFilterTools.kt FilterTypeʹՃ private enum class FilterType {
CONTRAST, GRAYSCALE, SHARPEN, SEPIA, SOBEL_EDGE_DETECTION, THRESHOLD_EDGE_DETECTION, THREE_X_THREE_CONVOLUTION, FILTER_GROUP, EMBOSS, …, SOLARIZE }
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ fun showDialog( context: Context, listener: (filter: GPUImageFilter)
-> Unit ) { val filters = FilterList().apply { addFilter("Contrast", FilterType.CONTRAST) addFilter("Invert", FilterType.INVERT) addFilter("Pixelation", FilterType.PIXELATION) addFilter("Hue", FilterType.HUE) addFilter("Gamma", FilterType.GAMMA) addFilter("Brightness", FilterType.BRIGHTNESS) addFilter("Sepia", FilterType.SEPIA) addFilter("Grayscale", FilterType.GRAYSCALE) … addFilter("Solarize", FilterType.SOLARIZE) } … } sample/GPUImageFilterTools.kt FilterListʹՃ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ sample/GPUImageFilterTools.kt ࡞ͬͨFilterΛબͰ͖ΔΑ͏ʹ private fun createFilterForType(context: Context, type:
FilterType): GPUImageFilter { return when (type) { FilterType.CONTRAST -> GPUImageContrastFilter(2.0f) FilterType.GAMMA -> GPUImageGammaFilter(2.0f) FilterType.INVERT -> GPUImageColorInvertFilter() FilterType.PIXELATION -> GPUImagePixelationFilter() FilterType.HUE -> GPUImageHueFilter(90.0f) FilterType.BRIGHTNESS -> GPUImageBrightnessFilter(1.5f) FilterType.GRAYSCALE -> GPUImageGrayscaleFilter() FilterType.LEVELS_FILTER_MIN -> GPUImageLevelsFilter() FilterType.HALFTONE -> GPUImageHalftoneFilter() FilterType.BILATERAL_BLUR -> GPUImageBilateralBlurFilter() FilterType.TRANSFORM2D -> GPUImageTransformFilter() … FilterType.SOLARIZE -> GPUImageSolarizeFilter() } }
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ Ϧετʹදࣔ͞ΕΔΑ͏ʹͳΓ·ͨ͠
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ ͜ͷ··Ͱ֬ೝͰ͖ͳ͍ͷͰ AdjusterΛ࡞ͬͯFilterͱͯ͠ಈ͔͢
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ sample/GPUImageFilterTools.kt AdjusterΫϥεΛ࡞ class FilterAdjuster(filter: GPUImageFilter) { …
private inner class BilateralAdjuster(filter: GPUImageBilateralBlurFilter) : Adjuster<GPUImageBilateralBlurFilter>(filter) { override fun adjust(percentage: Int) { filter.setDistanceNormalizationFactor(range(percentage, 0.0f, 15.0f)) } } … private inner class SolarizeAdjuster(filter: GPUImageSolarizeFilter) : Adjuster<GPUImageSolarizeFilter>(filter) { override fun adjust(percentage: Int) { filter.setThreshold(range(percentage, 0.0f, 1.0f)) } } }
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ sample/GPUImageFilterTools.kt ࡞ͬͨAdjusterΛՃ class FilterAdjuster(filter: GPUImageFilter) { private
val adjuster: Adjuster<out GPUImageFilter>? init { adjuster = when (filter) { … is GPUImageLevelsFilter -> LevelsMinMidAdjuster(filter) is GPUImageBilateralBlurFilter -> BilateralAdjuster(filter) is GPUImageTransformFilter -> RotateAdjuster(filter) is GPUImageSolarizeFilter -> SolarizeAdjuster(filter) else -> null } }
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ ಈ͖·ͨ͠
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 4. PRΛग़͢ - [x] Color Inversion - [x] Solarize
- [x] Vibrance - [x] Highlight and Shadow Tint ࡞ͬͨFilterͷCheckboxΛΕͣʹ㾎
ࠓ͙͢Ͱ͖Δʂcontributeͷํ ௨ৗͷखॱͰPRΛग़ͤOK 4. PRΛग़͢
ࠓ͙͢Ͱ͖Δʂcontributeͷํ CLA͕ඞཁͳͷͰɺCONTRIBUTING.mdͷϦϯΫ͔Β 4. PRΛग़͢
·ͱΊ
·ͱΊ 1. Ճ͢ΔFilterΛܾΊΔ 2. ຊՈGPUImage2ΛࢀߟʹFilterΛ࣮͢Δ 3. sampleͰ࡞ͬͨFilterΛ͑ΔΑ͏ʹ͢Δ 4. PRΛग़͢ ※࠶ܝ
·ͱΊ ͱͯ؆୯
·ͱΊ Thanks:)