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

Android Utils missing from opencv #549

Closed
richwandell opened this issue Apr 6, 2018 · 7 comments
Closed

Android Utils missing from opencv #549

richwandell opened this issue Apr 6, 2018 · 7 comments

Comments

@richwandell
Copy link

I am trying to convert a Bitmap to Mat and Mat back to Bitmap but everywhere I am finding this suggestions.

Mat mat = new Mat();    
Bitmap bmp32 = bmp.copy(Bitmap.Config.ARGB_8888, true);
Utils.bitmapToMat(bmp32, mat)

The "Utils" class seems to be missing from javacpp-presets:opencv:3.4.1-1.4.1

implementation 'org.bytedeco.javacpp-presets:opencv:3.4.1-1.4.1:android-arm', {
        exclude group: 'com.github.stephenc.findbugs', module: 'findbugs-annotations'
    }


    implementation 'org.bytedeco.javacpp-presets:opencv:3.4.1-1.4.1:linux-x86_64', {
        exclude group: 'com.github.stephenc.findbugs', module: 'findbugs-annotations'
    }
    implementation 'org.bytedeco.javacpp-presets:openblas:0.2.20-1.3', {
        exclude group: 'com.github.stephenc.findbugs', module: 'findbugs-annotations'
    }
    implementation 'org.bytedeco.javacpp-presets:openblas:0.2.20-1.3:linux-x86_64', {
        exclude group: 'com.github.stephenc.findbugs', module: 'findbugs-annotations'
    }
@saudet
Copy link
Member

saudet commented Apr 7, 2018

Done! Please try it out with 1.4.2-SNAPSHOT: http://bytedeco.org/builds/

@richwandell
Copy link
Author

Thanks!

I am getting the following build errors. Any idea how I can resolve these?

screen shot 2018-04-14 at 1 52 17 pm

@saudet
Copy link
Member

saudet commented Apr 14, 2018 via email

@saudet
Copy link
Member

saudet commented Apr 15, 2018

BTW, the Gradle team doesn't seem to care too much about snapshots at the moment, see: gradle/gradle#2882
https://discuss.gradle.org/t/maven-metadata-with-classifiers-fails-to-resolve-for-snapshots/20071

If you could let them know you need better Maven compatibility, that would be great!

@richwandell
Copy link
Author

Thanks for the help! I got it working

@saudet
Copy link
Member

saudet commented Apr 18, 2018

FYI, here's another way: bytedeco/javacv#945 (comment)

@nofurylion
Copy link

Hi,
Build target : Android 21+
Language : Kotlin
My gradle :

implementation group: 'org.bytedeco', name: 'opencv', version: '4.1.0-1.5.1'
implementation group: 'org.bytedeco', name: 'opencv', version: '4.1.0-1.5.1', classifier: "android-arm"

When using Utils.bitmapToMat(param1, param2), the only available Utils are from package org.opencv.android. I cant find Utils from package org.bytedeco.opencv.android .

This lead to error since param2 will require org.opencv.core.Mat instead of org.bytedeco.opencv.opencv_core.Mat

I've tried rough casting it like param2 as org.opencv.core.Mat but it lead to error "unable to cast".

Are there any alternative way to convert bitmap to mat easily?
and also why package org.opencv.* still exist in the library? Is that how wrappers work?
Screenshot_2019-07-13_17-53-25

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

No branches or pull requests

3 participants