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
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
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
How to contribute android-gpuimage
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Yuji Koketsu
November 16, 2018
Programming
680
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
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
440
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
660
FreeBSDでZabbixを動かす
kenkino
0
350
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.5k
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
340
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
230
R8 の設定見直しでアプリサイズ削減
andpad
0
140
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.5k
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
160
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
340
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
13
6.5k
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
390
Featured
See All Featured
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
710
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
390
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
300
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
My Coaching Mixtape
mlcsv
0
340
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
860
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
350
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:)