mebjas / mebjas.github.io

Repository for hosting my personal home page and blog.
https://blog.minhazav.dev
Apache License 2.0
13 stars 6 forks source link

Fast and maintainable image processing in Android with Halide - Part 3 | Minhaz’s Blog #42

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Fast and maintainable image processing in Android with Halide - Part 3 | Minhaz’s Blog

Halide is an open-source domain specific language designed to make it easier to write and maintain high-performance image processing or array processing code on modern machines. I have been writing a series on Halide and this article is 3rd one in the series. In this article I will be wrting about how to use Halide with Android. To assert on the performance benefits I am going to use the problem statement of YUV to RGB color format conversion. I have written couple of articles in the past showing different ways to do image processing in Android with this example.

https://blog.minhazav.dev/fast-and-maintanable-image-processing-in-android-with-halide-part-3/

FatimaZahra-FCH commented 1 year ago

Hello !

Thank you very much for all the interesting informations you provided.

How to setup Halide in Android Studio ? I want to convert Camera2 YUV_420_888 images using your Halide approach. I would be grateful if you could give me the detailed steps or a template code.

mebjas commented 1 year ago

I have never done this directly with Android Studio + Gradle (inside Google we do it slightly differently).

Let me give it a try and get back to you.

Meanwhile you can try this example: https://github.com/intel/Halide/tree/master/apps/HelloAndroidCamera2

FatimaZahra-FCH commented 1 year ago

Hello ! I tried building the example you provided on Android studio but I'm having many troubles. It seems like this project doesn't build on recent Android setups. Any news from your side ?

Samuel-Unknown commented 1 year ago

Please write a simple tutorial how to connect Hlide with Android Studio. It will be very helpful! 🥹

mebjas commented 1 year ago

Have you looked into this: https://github.com/intel/Halide/tree/master/apps/HelloAndroidCamera2?

It's not an article but has the required hints.

TarikTaoui commented 1 year ago

Hello Minhaz,

Following the link that you provided, it seems that building the project for recent Android Studio + Gradle 7.2 is quite messy. the Gradle project sync fails with the following error "Could not find method sources() for arguments [build_9h79tf311lno8h1gwnpsey8dk$_run_closure2@c56453d] on root project 'HelloAndroidCamera2' of type org.gradle.api.Project."

It would be much appreciated if you can provide a tutorial on how to integrate Hadile into an Android Studio + Gradle project.

Samuel-Unknown commented 1 year ago

I figured out how to connect Halide generators to my project. It's not obvious at all and took a lot of time! The Intel repository example was useless to me. I will make a repository with an example that will contain a modern stack for Android. I'll share the link here later when it will be done.

TarikTaoui commented 1 year ago

Great news Samuel, I'll be waiting for you to provide the link. Great work👍

mebjas commented 1 year ago

@Samuel-Unknown That's good to know. I am happy to add a reference to your repo / article to guide the users towards it!

Samuel-Unknown commented 1 year ago

I created the repository with an example of using Halide generators in an Android app: https://github.com/Samuel-Unknown/Halide-Android-Sample

I hope it will be helpful! 😌

TarikTaoui commented 1 year ago

@mebjas is it possible for you to share the JNI code that you used to connect the generator to the Java code ?

TarikTaoui commented 1 year ago

Hello again @mebjas , is it possible for you to share your JNI code ?