The power of AI in the palm of my hands!
This is AI utility app for Android device, it basically uses AI model directly on-device to help on performing some tasks.
- Detect and add blur effect on people face and export the result to gallery
- Detect and select which face to be blurred and export the result to gallery
- Select neural style transfer theme to apply to the image(s) and export the result to gallery. (Themes: Mosaic,Candy,Rain Princess,Udnie,Pointilism)
The project follows a modular, layered architecture designed to separate concerns between the UI, business logic, and heavy ML processing.
:app: The entry point. Contains the UI, Navigation, and Command implementations. It manages user interaction and delegates tasks.:ml-engine: The core intelligence. Encapsulates ML models (OpenCV, etc.), logic engines (FaceEngine,STEngine), and background workers (WorkManager).:base: Shared infrastructure. Contains DI setup (a-providermodules), utilities (FileHelper,MediaHelper), and common UI components.:opencv: Wraps the OpenCV library integration.
- a-navigator: Handles navigation between pages/activities.
- a-provider: A lightweight Dependency Injection (DI) framework.
- StatefulView: A framework for building state-aware UI components.
- RxAndroid (RxJava 3): Manages asynchronous events and threading in the UI layer.
- WorkManager: Handles deferrable, guaranteed background work (ML processing).
- OpenCV: Powers the face detection and recognition capabilities.
The application heavily utilizes the Command Pattern to decouple the UI from the execution logic.
- User Interaction: The user triggers an action (e.g., "Auto Blur Face") in the UI (
HomePage). - Command Execution: The UI invokes a specific Command (e.g.,
BlurFaceCommand). - Engine Delegation: The Command prepares the data and delegates the task to a specific Engine (e.g.,
FaceEngine). - Background Work: The Engine serializes the request and enqueues it to the WorkManager.
- Processing: The background Worker (
BlurFaceWorkRequest) wakes up, deserializes the data, and runs the heavy ML algorithms. - Result: The processed image is saved to the gallery, and the user is notified.
sequenceDiagram
participant UI as HomePage (UI)
participant Cmd as BlurFaceCommand
participant Eng as FaceEngine
participant WM as WorkManager
participant Wkr as BlurFaceWorkRequest
participant ML as OpenCV/ML Model
UI->>Cmd: execute(imageUri)
Cmd->>Eng: enqueueBlurFace(file, params)
Eng->>WM: enqueue(OneTimeWorkRequest)
Note over WM: Background Processing
WM->>Wkr: doWork()
Wkr->>Eng: blurFace(bitmap)
Eng->>ML: detect/recognize/blur
ML-->>Eng: Result Bitmap
Eng-->>Wkr: Result
Wkr->>UI: Save to Gallery / Notify
- HomePage: Calls
mBlurFaceCommand.execute(uri). - BlurFaceCommand: Copies the image to a temp file and calls
mFaceEngine.enqueueBlurFace(...). - FaceEngine:
- Creates a
BlurFaceSerialFileobject containing file paths and configuration. - Serializes this object to disk.
- Creates a
OneTimeWorkRequestpointing toBlurFaceWorkRequest, passing the serialized file path as input data. - Enqueues the request to
WorkManager.
- Creates a
- BlurFaceWorkRequest (Background):
- Reads the serialized file.
- Loads the image bitmaps.
- Calls
faceEngine.blurFace(). FaceEngineusesOpenCV'sFaceDetectorYNto find faces andFaceRecognizerSFto match identities (if excluding faces).- Applies a blur effect to the detected regions.
- Saves the final image using
MediaHelper.
- HomePage: Collects image and theme selection, then calls
mSTApplyCommand.execute(uri, themes). - STApplyCommand: Delegated to
STEngine.enqueueST(...). - STEngine: Serializes the request and enqueues a
STApplyWorkRequest. - STApplyWorkRequest (Background):
- Deserializes data.
- Iterates through selected themes (Mosaic, Candy, etc.).
- Calls
STEngine.apply(), which delegates to specific model processors (e.g.,NSTMosaic). - Saves each stylized image to the gallery.
Consider donation to support this project
| https://trakteer.id/rh-id |