Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java compatiblity #17

Open
hamzakhalil798 opened this issue Jun 3, 2024 · 1 comment
Open

Java compatiblity #17

hamzakhalil798 opened this issue Jun 3, 2024 · 1 comment

Comments

@hamzakhalil798
Copy link

sorry for the dumb question im new to this.
does this lib work with java?

@DHD2280
Copy link

DHD2280 commented Oct 12, 2024

You should use a kotlin class with a wrapper

Something like this:

private suspend fun segmentSubject(
        inputBitmap: Bitmap,
        listener: SegmentResultListener
    ) {
        mBgRemover.clearBackground(inputBitmap).collect { output ->
            listener.onSuccess(output)
        }
    }

    fun segmentSubjectFromJava(inputBitmap: Bitmap, listener: SegmentResultListener) {
        CoroutineScope(Dispatchers.IO).launch {
            try {
                segmentSubject(inputBitmap, listener)
            } catch (e: Exception) {
                listener.onFail(e)
            }
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants