Ask Your Question

android SLIC superpixel

asked 2018-09-12 18:08:40 -0500

manef gravatar image

I'm new android developer. I'm looking to use the superpixel SLIC algorithm on android studio. but after testing my code i got this bug:

java.lang.UnsatisfiedLinkError: No implementation found for long org.opencv.ximgproc.Ximgproc.createSuperpixelSLIC_0(long, int, int, float) (tried Java_org_opencv_ximgproc_Ximgproc_createSuperpixelSLIC_10 and Java_org_opencv_ximgproc_Ximgproc_createSuperpixelSLIC_10__JIIF)

And this is my Code, can someone help me i need the SLIC superpixel in my app and i couldn't figure out how to resolve this bug ?!!!

public class MainActivity extends AppCompatActivity {

private static final String TAG = "3:qinQctivity";
Button button;
ImageView imageView;

Mat newImage;

protected void onCreate(Bundle savedInstanceState) {
    button = findViewById(;
    imageView = findViewById(;

    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {

            if (!OpenCVLoader.initDebug()) {
                OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_4_0, getApplicationContext(), baseLoaderCallback);
            } else {



BaseLoaderCallback baseLoaderCallback = new BaseLoaderCallback(this) {
    public void onManagerConnected(int status) {
        if (status == LoaderCallbackInterface.SUCCESS) {
            try {
                newImage = new Mat();

                newImage = Utils.loadResource(getApplicationContext(), R.drawable.retinalimage, CvType.CV_32FC3);

                SuperpixelSLIC x= Ximgproc.createSuperpixelSLIC(newImage, Ximgproc.SLIC,50,(float)0.001);

            } catch(IOException e){


} ;

void showImage (Mat y){
    Bitmap bm = Bitmap.createBitmap(y.width(), y.height(), Bitmap.Config.ARGB_8888);
    Utils.matToBitmap(y, bm);


edit retag flag offensive close merge delete


this function will only exist, IF you rebuilt the sdk with opencv_contrib locally, so, did you do that ?

berak gravatar imageberak ( 2018-09-13 00:40:33 -0500 )edit

oh, and afaik, you cannot use dynamic initialization (and the opencv manager app, because that does not have any contrib libs)

berak gravatar imageberak ( 2018-09-13 05:22:01 -0500 )edit

i'm using opencv_contiv 3.4.1 from link text android studio accepted the SuperpixelSLIC type

manef gravatar imagemanef ( 2018-09-13 07:09:30 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-10-11 09:16:35 -0500

manef gravatar image

i found the solution, i had to install opencv manager higher than i used before ( 3.0.0) so installed opencv manager 3.4 and it worked for me, i added some code line to have the result i'm looking for.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-09-12 18:08:40 -0500

Seen: 50 times

Last updated: Oct 11