[PAID] ImageSegmentation: Remove, replace and blur background of Image using AI ($6 or INR 421)

ImageSegmentation Extension

With ImageSegmenation extension you can easily remove, replace and blur background of an Image using AI which ensures results will be quite good. You might feel sometimes results are not completely accurate but then it's limitation of lite model running on Android. It works completely offline without requirement of Internet or any API.

1. Overview

LatestVersion: 2
Released: 2024-05-21T18:30:00Z
Last Updated: 2024-07-24T18:30:00Z
Min SDK: 21
Permissions: READ_MEDIA_IMAGES (not required if you use Activity Starter to pick images)

Aix Size: 1.1 mb

Key Features:

  • Easy Integration: Simple and easy to understand extension blocks
  • High Accuracy: Utilizes advanced machine learning models to accurately distinguish between the person/s (or objects) and the background.
  • Customizable Output: Offers flexibility in output image quality and you can customize confidence threshold of Segmenter to avoid losing too much details or vice-versa.
  • Optimized for Performance: Optimized to run efficiently on mobile devices, balancing performance and battery consumption.
  • Offline Capability: Can run locally on the device, without needing an internet connection.

2. Blocks

image

3. Documentation

Events

LibrariesLoaded Event raised when native libraries have been loaded successfully
BackgroundRemoved Event raised after getting output image path. It is a temp file so it will be deleted as soon as user closes app.
imagePath | text
ErrorOccurred Event raised when any error occurs.
errorMsg | text
BackgroundReplaced Event raised after replacing image's background with color. It is a temp file so it will be deleted as soon as user closes app.
imagePath | text

Methods

IsInitialized Returns whether Image Segmenter has been initialized or not
LoadLibraries Tries to load native libraries from zip. 'zipPath' can be file path and direct url.
zipPath | text
Initialize Initialize Image Segmenter with provided thresholdConfidence threshold. A pixel having thresholdConfidence less than this value will be removed from foreground. Default value is 0.5, however it is recommended to keep it between 0.5 and 0.8 to avoid losing image details.
confidenceThreshold | number
ProcessImage Process input image (can be Image component, file path or content uri) to remove background from it
image | any
ReplaceBackgroundWithColor Replaces background color of provided image
bgColor | number
imagePath | text
Release Closes Image Segmenter and releases acquired resources.

Properties

OutputQuality Sets output image quality. Default value is 100.
Property Type : write-only
Accepts : number
BlurBackground Tells segmenter to blur background instead of removing it.
Property Type : write-only
Accepts : boolean
BlurRadius Sets blur radius, value should be between 1 and 25. Default value is 10.
Property Type : write-only
Accepts : number

4. Example Usage

Load Native Libraries
You can load native libraries either using url or file path. Also you can use NativeUtil extension to find recommended ABI type to download/load only required library. This will help you to reduce app size on device.


LibrariesLoaded event will be raised if libs have been loaded successfully, otherwise ErrorOccurred event will be raised.

Then initialize Image Segmenter with appropriate confidence threshold. 1.0 means only pixels with very high probability of being foreground will be included in final image. This value will lose a lot of required details in image.
0.1 means pixels with low probablity will also be included in foreground so it may produce highly inaccurate results.
So choose something median value like 0.5.
image

Now if initialization was successful then proceed to process input image.
I’ll use Activity Starter to pick image and then show on Image component.

After background is removed from image, it is saved to a temp file which will be deleted once user exits app.
Processing time depends upon image quality and size.

Release Segmenter once your job is done.
image

Not mandatory, but as a good practice.

5. Samples and Demo

Original Image Background Removed

Demo Video:

6. Purchase Extension

https://sunnythedeveloper.in/830-2/

Thank you.
Hope it helps!

8 Likes

Awesome work man, keep it up :+1:

3 Likes

Good job :+1: @vknow360

2 Likes

wow great work

ChangeLog Version 2

  • Native Libraries can be loaded at runtime using zip files, so apk size will not increase. No need to inject .so files.
    image
    zipPath can be file path or url

  • Now you can set background color of a transparent (png) image
    image

  • Added BlurBackground property to blur background of image instead of removing it
    BlurRadius property has been added also to control intensity (1 to 25) of Blur. However, note that it depends upon complexity of image’s background as well.

1 Like

Price has been reduced to $6 or INR 421

1 Like