Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error when tring to train image with opencv and android

  public class MainActivity extends Activity {
Button button;

ImageView res4;
TextView T1;
private static final String TAG = "training";

private BaseLoaderCallback mLoaderCallBack = new BaseLoaderCallback(this) {
    public void onManagerConnected(int status) {
        switch (status) {
        case LoaderCallbackInterface.SUCCESS:
            Log.i(TAG, "Open CV loaded successfully");
            break;

        default:
            super.onManagerConnected(status);
            break;
        }
    };
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    setContentView(R.layout.activity_main);
    addListenerOnButton();

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public void onResume() {
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_1_0, this,mLoaderCallBack);

}



public void addListenerOnButton() {

//  imageView = (ImageView) findViewById(R.id.imageView1);

    res4 = (ImageView) findViewById(R.id.imageView2);
    button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(new OnClickListener() {



        @Override
        public void onClick(View arg0) {


                try {

                train();

            } catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }
        }

    });

}
public void train (){
     String path = Environment.getExternalStorageDirectory().toString();                  
     Mat trainData = new Mat(); 
     Mat response_array = new Mat();
    Mat img =Imgcodecs.imread("/storage/emulated/0/DCIM/Camera/n1.png");
     img.convertTo(img, CvType.CV_32FC1);
     Size dsize = new Size(50, 50); 
     Imgproc.resize(img, img, dsize);  
     img.convertTo(img, CvType.CV_32FC1);
     Mat imgResized = img.reshape(1, 1);   
     trainData.push_back(imgResized);
     Mat response = new Mat();
     Mat tmp; 
     tmp=response_array.reshape(1,1); //make continuous  `
     tmp.convertTo(response,CvType.CV_32FC1); // Convert  to float`  
     KNearest knn = KNearest.create();
     knn.train(trainData,Ml.ROW_SAMPLE, response);


    Bitmap bmpOut1 = Bitmap.createBitmap(trainData.cols(), trainData.rows(), Bitmap.Config.ARGB_8888);
    trainData.convertTo(trainData,CvType.CV_8UC1); 
    Utils.matToBitmap(trainData, bmpOut1);
    File file = new File(path);  
    file.mkdirs(); 
    File file1 = new File(path, "train.jpg"); 
    OutputStream fout = null;
     try {  fout = new FileOutputStream(file1); 
     BufferedOutputStream bos = new BufferedOutputStream(fout); 
     bmpOut1.compress(Bitmap.CompressFormat.JPEG, 100, bos);
     bos.flush(); 
     bos.close();  
     bmpOut1.recycle(); 
     }
     catch (FileNotFoundException e) { e.printStackTrace(); }
     catch (IOException e) {e.printStackTrace();}

}
 }

I get these errors .Please help me and also i don't know how can i recognize my code

image description

Error when tring to train image with opencv and android

  public class MainActivity extends Activity {
Button button;

ImageView res4;
TextView T1;
private static final String TAG = "training";

private BaseLoaderCallback mLoaderCallBack = new BaseLoaderCallback(this) {
    public void onManagerConnected(int status) {
        switch (status) {
        case LoaderCallbackInterface.SUCCESS:
            Log.i(TAG, "Open CV loaded successfully");
            break;

        default:
            super.onManagerConnected(status);
            break;
        }
    };
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    setContentView(R.layout.activity_main);
    addListenerOnButton();

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public void onResume() {
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_1_0, this,mLoaderCallBack);

}



public void addListenerOnButton() {

//  imageView = (ImageView) findViewById(R.id.imageView1);

    res4 = (ImageView) findViewById(R.id.imageView2);
    button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(new OnClickListener() {



        @Override
        public void onClick(View arg0) {


                try {

                train();

            } catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }
        }

    });

}
public void train (){
        //Creating Training Data
     String path = Environment.getExternalStorageDirectory().toString();                  
     Mat trainData = new Mat(); 
     Mat response_array = new Mat();
    Mat img =Imgcodecs.imread("/storage/emulated/0/DCIM/Camera/n1.png");
     img.convertTo(img, CvType.CV_32FC1);
     Size dsize = new Size(50, 50); 
     Imgproc.resize(img, img, dsize);  
     img.convertTo(img, CvType.CV_32FC1);
     Mat imgResized = img.reshape(1, 1);   
     trainData.push_back(imgResized);
     Mat response = new Mat();
     Mat tmp; 
     tmp=response_array.reshape(1,1); //make continuous  `
     tmp.convertTo(response,CvType.CV_32FC1); // Convert  to float` float  
     KNearest knn = KNearest.create();
     knn.train(trainData,Ml.ROW_SAMPLE, response);

      //For Storing training data
    Bitmap bmpOut1 = Bitmap.createBitmap(trainData.cols(), trainData.rows(), Bitmap.Config.ARGB_8888);
    trainData.convertTo(trainData,CvType.CV_8UC1); 
    Utils.matToBitmap(trainData, bmpOut1);
    File file = new File(path);  
    file.mkdirs(); 
    File file1 = new File(path, "train.jpg"); "train.png"); 
    OutputStream fout = null;
     try {  fout = new FileOutputStream(file1); 
     BufferedOutputStream bos = new BufferedOutputStream(fout); 
     bmpOut1.compress(Bitmap.CompressFormat.JPEG, bmpOut1.compress(Bitmap.CompressFormat.PNG, 100, bos);
     bos.flush(); 
     bos.close();  
     bmpOut1.recycle(); 
     }
     catch (FileNotFoundException e) { e.printStackTrace(); }
     catch (IOException e) {e.printStackTrace();}

     //For Accessing training data in BMP file  

     BitmapFactory.Options o = new BitmapFactory.Options(); 
     o.inScaled = false;
     Bitmap blankBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.train,o);
     int trainWidth = blankBitmap.getWidth();
     int trainHeight = blankBitmap.getHeight();
     Mat trainData2 = new Mat();
     Utils.bitmapToMat(blankBitmap,trainData2); 
     Mat trainData3 = new Mat();
     Mat response3 = new Mat();

     Imgproc.cvtColor(trainData2,trainData2,Imgproc.COLOR_BGRA2GRAY); // 1. change the number of channels; 
     trainData2.convertTo(trainData3,CvType.CV_32FC1); 
     KNearest knn2 = KNearest.create();
     knn.train(trainData3,Ml.ROW_SAMPLE, response3);

}
 }

I get these errors .Please help me and also i don't know how can i recognize my code

image description

Error when tring to train image with opencv and android

  public class MainActivity extends Activity {
Button button;

ImageView res4;
TextView T1;
private static final String TAG = "training";

private BaseLoaderCallback mLoaderCallBack = new BaseLoaderCallback(this) {
    public void onManagerConnected(int status) {
        switch (status) {
        case LoaderCallbackInterface.SUCCESS:
            Log.i(TAG, "Open CV loaded successfully");
            break;

        default:
            super.onManagerConnected(status);
            break;
        }
    };
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    setContentView(R.layout.activity_main);
    addListenerOnButton();

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public void onResume() {
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_1_0, this,mLoaderCallBack);

}



public void addListenerOnButton() {

//  imageView = (ImageView) findViewById(R.id.imageView1);

    res4 = (ImageView) findViewById(R.id.imageView2);
    button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(new OnClickListener() {



        @Override
        public void onClick(View arg0) {


                try {

                train();

            } catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }
        }

    });

}
public void train (){
        //Creating Training Data
     String path = Environment.getExternalStorageDirectory().toString();                  
     Mat trainData = new Mat(); 
     Mat response_array = new Mat();
    Mat img =Imgcodecs.imread("/storage/emulated/0/DCIM/Camera/n1.png");
    img.convertTo(img, CvType.CV_32FC1);
     Size dsize = new Size(50, 50); 
     Imgproc.resize(img, img, dsize);  
     img.convertTo(img, CvType.CV_32FC1);
     Mat imgResized = img.reshape(1, 1);   
     trainData.push_back(imgResized);
     Mat response = new Mat();
     Mat tmp; 
     tmp=response_array.reshape(1,1); //make continuous  `
     tmp.convertTo(response,CvType.CV_32FC1); // Convert  to float  
     KNearest knn = KNearest.create();
     knn.train(trainData,Ml.ROW_SAMPLE, response);

     //For Storing training data
    Bitmap bmpOut1 = Bitmap.createBitmap(trainData.cols(), trainData.rows(), Bitmap.Config.ARGB_8888);
    trainData.convertTo(trainData,CvType.CV_8UC1); 
    Utils.matToBitmap(trainData, bmpOut1);
    File file = new File(path);  
    file.mkdirs(); 
    File file1 = new File(path, "train.png"); 
    OutputStream fout = null;
     try {  fout = new FileOutputStream(file1); 
     BufferedOutputStream bos = new BufferedOutputStream(fout); 
     bmpOut1.compress(Bitmap.CompressFormat.PNG, 100, bos);
     bos.flush(); 
     bos.close();  
     bmpOut1.recycle(); 
     }
     catch (FileNotFoundException e) { e.printStackTrace(); }
     catch (IOException e) {e.printStackTrace();}

     //For Accessing training data in BMP file  

     BitmapFactory.Options o = new BitmapFactory.Options(); 
     o.inScaled = false;
     Bitmap blankBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.train,o);
     int trainWidth = blankBitmap.getWidth();
     int trainHeight = blankBitmap.getHeight();
     Mat trainData2 = new Mat();
     Utils.bitmapToMat(blankBitmap,trainData2); 
     Mat trainData3 = new Mat();
     Mat response3 = new Mat();

     Imgproc.cvtColor(trainData2,trainData2,Imgproc.COLOR_BGRA2GRAY); // 1. change the number of channels; 
     trainData2.convertTo(trainData3,CvType.CV_32FC1); 
     KNearest knn2 = KNearest.create();
     knn.train(trainData3,Ml.ROW_SAMPLE, response3);

}
 }

I get these errors .Please help me and also i don't know how can i recognize my code

image description

Error when tring to train image with opencv and android

  public class MainActivity extends Activity {
Button button;

ImageView res4;
TextView T1;
private static final String TAG = "training";

private BaseLoaderCallback mLoaderCallBack = new BaseLoaderCallback(this) {
    public void onManagerConnected(int status) {
        switch (status) {
        case LoaderCallbackInterface.SUCCESS:
            Log.i(TAG, "Open CV loaded successfully");
            break;

        default:
            super.onManagerConnected(status);
            break;
        }
    };
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    setContentView(R.layout.activity_main);
    addListenerOnButton();

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public void onResume() {
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_1_0, this,mLoaderCallBack);

}



public void addListenerOnButton() {

//  imageView = (ImageView) findViewById(R.id.imageView1);

    res4 = (ImageView) findViewById(R.id.imageView2);
    button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(new OnClickListener() {



        @Override
        public void onClick(View arg0) {


                try {

                train();

            } catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }
        }

    });

}
public void train (){
        //Creating Training Data
     String path = Environment.getExternalStorageDirectory().toString();                  
     Mat trainData = new Mat(); 
     Mat response_array = new Mat();
    Mat img =Imgcodecs.imread("/storage/emulated/0/DCIM/Camera/n1.png");
    img.convertTo(img, CvType.CV_32FC1);
     Size dsize = new Size(50, 50); 
     Imgproc.resize(img, img, dsize);  
     img.convertTo(img, CvType.CV_32FC1);
     Mat imgResized = img.reshape(1, 1);   
     trainData.push_back(imgResized);
     Mat response = new Mat();
     Mat tmp; 
     tmp=response_array.reshape(1,1); //make continuous  `
     tmp.convertTo(response,CvType.CV_32FC1); // Convert  to float  
     KNearest knn = KNearest.create();
     knn.train(trainData,Ml.ROW_SAMPLE, response);

     //For Storing training data
    Bitmap bmpOut1 = Bitmap.createBitmap(trainData.cols(), trainData.rows(), Bitmap.Config.ARGB_8888);
    trainData.convertTo(trainData,CvType.CV_8UC1); 
    Utils.matToBitmap(trainData, bmpOut1);
    File file = new File(path);  
    file.mkdirs(); 
    File file1 = new File(path, "train.png"); 
    OutputStream fout = null;
     try {  fout = new FileOutputStream(file1); 
     BufferedOutputStream bos = new BufferedOutputStream(fout); 
     bmpOut1.compress(Bitmap.CompressFormat.PNG, 100, bos);
     bos.flush(); 
     bos.close();  
     bmpOut1.recycle(); 
     }
     catch (FileNotFoundException e) { e.printStackTrace(); }
     catch (IOException e) {e.printStackTrace();}

     //For Accessing training data in BMP file  

     BitmapFactory.Options o = new BitmapFactory.Options(); 
     o.inScaled = false;
     Bitmap blankBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.train,o);
     int trainWidth = blankBitmap.getWidth();
     int trainHeight = blankBitmap.getHeight();
     Mat trainData2 = new Mat();
     Utils.bitmapToMat(blankBitmap,trainData2); 
     Mat trainData3 = new Mat();
     Mat response3 = new Mat();

     Imgproc.cvtColor(trainData2,trainData2,Imgproc.COLOR_BGRA2GRAY); // 1. change the number of channels; 
     trainData2.convertTo(trainData3,CvType.CV_32FC1); 
     KNearest knn2 = KNearest.create();
     knn.train(trainData3,Ml.ROW_SAMPLE, response3);

}
 }

I get these errors .Please help me and also i don't know how can i recognize my code

Error when tring to train image with opencv and android

  public class MainActivity extends Activity {
Button button;

ImageView res4;
TextView T1;
private static final String TAG = "training";

private BaseLoaderCallback mLoaderCallBack = new BaseLoaderCallback(this) {
    public void onManagerConnected(int status) {
        switch (status) {
        case LoaderCallbackInterface.SUCCESS:
            Log.i(TAG, "Open CV loaded successfully");
            break;

        default:
            super.onManagerConnected(status);
            break;
        }
    };
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    setContentView(R.layout.activity_main);
    addListenerOnButton();

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public void onResume() {
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_1_0, this,mLoaderCallBack);

}



public void addListenerOnButton() {

//  imageView = (ImageView) findViewById(R.id.imageView1);

    res4 = (ImageView) findViewById(R.id.imageView2);
    button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(new OnClickListener() {



        @Override
        public void onClick(View arg0) {


                try {

                train();

            } catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }
        }

    });

}
public void train (){
        //Creating Training Data
     String path = Environment.getExternalStorageDirectory().toString();                  
     Mat trainData = new Mat(); 
     Mat response_array = new Mat();
    Mat img =Imgcodecs.imread("/storage/emulated/0/DCIM/Camera/n1.png");
    img.convertTo(img, CvType.CV_32FC1);
     Size dsize = new Size(50, 50); 
     Imgproc.resize(img, img, dsize);  
     img.convertTo(img, CvType.CV_32FC1);
     Mat imgResized = img.reshape(1, 1);   
     trainData.push_back(imgResized);
     Mat response = new Mat();
     Mat tmp; 
     tmp=response_array.reshape(1,1); //make continuous  `
     tmp.convertTo(response,CvType.CV_32FC1); // Convert  to float  
     KNearest knn = KNearest.create();
     knn.train(trainData,Ml.ROW_SAMPLE, response);

     //For Storing training data
    Bitmap bmpOut1 = Bitmap.createBitmap(trainData.cols(), trainData.rows(), Bitmap.Config.ARGB_8888);
    trainData.convertTo(trainData,CvType.CV_8UC1); 
    Utils.matToBitmap(trainData, bmpOut1);
    File file = new File(path);  
    file.mkdirs(); 
    File file1 = new File(path, "train.png"); 
    OutputStream fout = null;
     try {  fout = new FileOutputStream(file1); 
     BufferedOutputStream bos = new BufferedOutputStream(fout); 
     bmpOut1.compress(Bitmap.CompressFormat.PNG, 100, bos);
     bos.flush(); 
     bos.close();  
     bmpOut1.recycle(); 
     }
     catch (FileNotFoundException e) { e.printStackTrace(); }
     catch (IOException e) {e.printStackTrace();}

     //For Accessing training data in BMP file  

     BitmapFactory.Options o = new BitmapFactory.Options(); 
     o.inScaled = false;
     Bitmap blankBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.train,o);
     int trainWidth = blankBitmap.getWidth();
     int trainHeight = blankBitmap.getHeight();
     Mat trainData2 = new Mat();
     Utils.bitmapToMat(blankBitmap,trainData2); 
     Mat trainData3 = new Mat();
     Mat response3 = new Mat();

     Imgproc.cvtColor(trainData2,trainData2,Imgproc.COLOR_BGRA2GRAY); // 1. change the number of channels; 
     trainData2.convertTo(trainData3,CvType.CV_32FC1); 
     KNearest knn2 = KNearest.create();
     knn.train(trainData3,Ml.ROW_SAMPLE, response3);

}
 }

I get these errors .Please help me and also i don't know how can i recognize my code

04-14 11:57:29.550: I/art(7070): Ignoring second debugger -- accepting and dropping 04-14 11:57:43.890: D/PhoneWindow(9670): FMB installDecor mIsFloating : false 04-14 11:57:43.890: D/PhoneWindow(9670): FMB installDecor flags : 8454400 04-14 11:57:44.040: D/OpenGLRenderer(9670): Render dirty regions requested: true 04-14 11:57:44.100: D/PhoneWindow(9670): FMB isFloatingMenuEnabled mFloatingMenuBtn : null 04-14 11:57:44.100: D/PhoneWindow(9670): FMB isFloatingMenuEnabled return false 04-14 11:57:44.150: D/SRIB_DCS(9670): log_dcs ThreadedRenderer::initialize entered! 04-14 11:57:44.150: I/Adreno-EGL(9670): <qegldrvapi_eglinitialize:379>: EGL 1.4 QUALCOMM build: SKARAJGA_AU_LINUX_ANDROID_LA.BR.1.1.2_RB1.05.00.02.031.018+PATCH[ES]_msm8916_32_refs/tags/AU_LINUX_ANDROID_LA.BR.1.1.2_RB1.05.00.02.031.018__release_ENGG (I856e09677e) 04-14 11:57:44.150: I/Adreno-EGL(9670): OpenGL ES Shader Compiler Version: E031.25.03.02 04-14 11:57:44.150: I/Adreno-EGL(9670): Build Date: 04/06/15 Mon 04-14 11:57:44.150: I/Adreno-EGL(9670): Local Branch: 04-14 11:57:44.150: I/Adreno-EGL(9670): Remote Branch: refs/tags/AU_LINUX_ANDROID_LA.BR.1.1.2_RB1.05.00.02.031.018 04-14 11:57:44.150: I/Adreno-EGL(9670): Local Patches: 112c106f3772623daa7b4181c6cf23491044ead1 Revert "Disable ASTC on A405" 04-14 11:57:44.150: I/Adreno-EGL(9670): 58a118cb818fdc906095a49a90977c15f9d3b223 Remove ASTC 04-14 11:57:44.150: I/OpenGLRenderer(9670): Initialized EGL, version 1.4 04-14 11:57:44.180: D/OpenGLRenderer(9670): Get maximum texture size. GL_MAX_TEXTURE_SIZE is 4096 04-14 11:57:44.180: D/OpenGLRenderer(9670): Enabling debug mode 0 04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Service connection created 04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Trying to get library path 04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Trying to get library list 04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Library list: "null" 04-14 11:57:44.220: D/OpenCVManager/Helper(9670): First attempt to load libs 04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Trying to init OpenCV libs 04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Trying to load library /data/app/org.opencv.engine-1/lib/arm/libopencv_java3.so 04-14 11:57:44.260: D/OpenCVManager/Helper(9670): OpenCV libs init was ok! 04-14 11:57:44.260: D/OpenCVManager/Helper(9670): First attempt to load libs is OK 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): videoio: Removing WinRT API headers by default 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): General configuration for OpenCV 3.0.0 ===================================== 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Version control: 3.0.0-6-gc1f114b-dirty 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Platform: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Host: Linux 3.13.0-53-generic x86_64 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Target: Linux 1 armv7-a 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): CMake: 2.8.12.2 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): CMake generator: Ninja 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): CMake build tool: /usr/bin/ninja 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Configuration: Release 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): C/C++: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Built as dynamic libs?: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): C++ Compiler: /usr/bin/ccache /home/maksim/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ (ver 4.8) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): C++ flags (Release): -fexceptions -frtti -fpic -Wno-psabi --sysroot=/home/maksim/android-ndk-r10e/platforms/android-8/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -fomit-frame-pointer -mfpu=neon -fvisibility=hidden -fvisibility-inlines-hidden -mthumb -fomit-frame-pointer -fno-strict-aliasing -O3 -DNDEBUG -DNDEBUG 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): C++ flags (Debug): -fexceptions -frtti -fpic -Wno-psabi --sysroot=/home/maksim/android-ndk-r10e/platforms/android-8/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -fomit-frame-pointer -mfpu=neon -fvisibility=hidden -fvisibility-inlines-hidden -marm -fno-omit-frame-pointer -fno-strict-aliasing -O0 -g -DDEBUG -D_DEBUG -O0 -DDEBUG -D_DEBUG 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): C Compiler: /usr/bin/ccache /home/maksim/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): C flags (Release): -fexceptions -fpic -Wno-psabi --sysroot=/home/maksim/android-ndk-r10e/platforms/android-8/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -fomit-frame-pointer -mfpu=neon -fvisibility=hidden -mthumb -fomit-frame-pointer -fno-strict-aliasing -O3 -DNDEBUG -DNDEBUG 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): C flags (Debug): -fexceptions -fpic -Wno-psabi --sysroot=/home/maksim/android-ndk-r10e/platforms/android-8/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -fomit-frame-pointer -mfpu=neon -fvisibility=hidden -marm -fno-omit-frame-pointer -fno-strict-aliasing -O0 -g -DDEBUG -D_DEBUG -O0 -DDEBUG -D_DEBUG 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Linker flags (Release): -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Linker flags (Debug): -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Precompiled headers: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Extra dependencies: z dl m log 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): 3rdparty dependencies: libjpeg libwebp libpng libtiff libjasper IlmImf tbb 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): OpenCV modules: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): To be built: hal core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d java stitching videostab 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Disabled: world 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Disabled by dependency: - 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev python2 viz 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Android: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Android ABI: armeabi-v7a with NEON 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): STL type: gnustl_static 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Native API level: android-8 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): SDK target: android-11 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Android NDK: /home/maksim/android-ndk-r10e (toolchain: arm-linux-androideabi-4.8) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): android tool: /home/maksim/android-sdk-linux/tools/android (Android SDK Tools, revision 24.3.) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Google Play manager: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Android examples: YES 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): GUI: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): GTK+: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): GThread : NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): GtkGlExt: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): OpenGL support: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): VTK support: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Media I/O: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): ZLib: z (ver 1.2.3) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): JPEG: build (ver 90) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): WEBP: build (ver 0.3.1) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): PNG: build (ver 1.5.12) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): TIFF: build (ver 42 - 4.0.2) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): JPEG 2000: build (ver 1.900.1) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): OpenEXR: build (ver 1.7.1) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): GDAL: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Video I/O: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Other third-party libraries: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Use IPP: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Use Eigen: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Use TBB: YES (ver 4.1 interface 6102) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Use OpenMP: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Use GCD NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Use Concurrency NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Use C=: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Use pthreads for parallel for: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Use Cuda: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Use OpenCL: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Python 2: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Interpreter: /usr/bin/python2.7 (ver 2.7.6) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Python 3: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Interpreter: /usr/bin/python3.4 (ver 3.4) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Python (for build): /usr/bin/python2.7 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Java: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): ant: /usr/bin/ant (ver 1.9.3) 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Java wrappers: YES 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Java tests: YES 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Matlab: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): mex: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Documentation: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Doxygen: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): PlantUML: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Tests and samples: 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Tests: YES 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Performance tests: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): C/C++ Examples: NO 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): Install path: /home/maksim/workspace/android-pack/builds/o4a/install 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): cvconfig.h is in: /home/maksim/workspace/android-pack/builds/o4a 04-14 11:57:44.260: I/OpenCVManager/Helper(9670): ----------------------------------------------------------------- 04-14 11:57:44.260: D/OpenCVManager/Helper(9670): Init finished with status 0 04-14 11:57:44.260: D/OpenCVManager/Helper(9670): Unbind from service 04-14 11:57:44.270: D/OpenCVManager/Helper(9670): Calling using callback 04-14 11:57:44.270: I/training(9670): Open CV loaded successfully 04-14 11:57:44.350: I/Timeline(9670): Timeline: Activity_idle id: android.os.BinderProxy@b1290da time:401459329 04-14 11:57:52.950: D/ViewRootImpl(9670): ViewPostImeInputStage ACTION_DOWN 04-14 11:57:53.070: E/cv::error()(9670): OpenCV Error: Assertion failed (ssize.area() > 0) in void cv::resize(cv::InputArray, cv::OutputArray, cv::Size, double, double, int), file /home/maksim/workspace/android-pack/opencv/modules/imgproc/src/imgwarp.cpp, line 3208 04-14 11:57:53.070: E/org.opencv.imgproc(9670): imgproc::resize_11() caught cv::Exception: /home/maksim/workspace/android-pack/opencv/modules/imgproc/src/imgwarp.cpp:3208: error: (-215) ssize.area() > 0 in function void cv::resize(cv::InputArray, cv::OutputArray, cv::Size, double, double, int) 04-14 11:57:53.070: W/System.err(9670): CvException [org.opencv.core.CvException: cv::Exception: /home/maksim/workspace/android-pack/opencv/modules/imgproc/src/imgwarp.cpp:3208: error: (-215) ssize.area() > 0 in function void cv::resize(cv::InputArray, cv::OutputArray, cv::Size, double, double, int) 04-14 11:57:53.070: W/System.err(9670): ] 04-14 11:57:53.070: W/System.err(9670): at org.opencv.imgproc.Imgproc.resize_1(Native Method) 04-14 11:57:53.070: W/System.err(9670): at org.opencv.imgproc.Imgproc.resize(Imgproc.java:2716) 04-14 11:57:53.070: W/System.err(9670): at com.example.nadiatrain.MainActivity.train(MainActivity.java:124) 04-14 11:57:53.070: W/System.err(9670): at com.example.nadiatrain.MainActivity$2.onClick(MainActivity.java:103) 04-14 11:57:53.070: W/System.err(9670): at android.view.View.performClick(View.java:5210) 04-14 11:57:53.070: W/System.err(9670): at android.view.View$PerformClick.run(View.java:20976) 04-14 11:57:53.070: W/System.err(9670): at android.os.Handler.handleCallback(Handler.java:739) 04-14 11:57:53.070: W/System.err(9670): at android.os.Handler.dispatchMessage(Handler.java:95) 04-14 11:57:53.070: W/System.err(9670): at android.os.Looper.loop(Looper.java:145) 04-14 11:57:53.070: W/System.err(9670): at android.app.ActivityThread.main(ActivityThread.java:6145) 04-14 11:57:53.070: W/System.err(9670): at java.lang.reflect.Method.invoke(Native Method) 04-14 11:57:53.070: W/System.err(9670): at java.lang.reflect.Method.invoke(Method.java:372) 04-14 11:57:53.070: W/System.err(9670): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) 04-14 11:57:53.070: W/System.err(9670): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

click to hide/show revision 6
No.6 Revision

updated 2016-04-14 06:35:47 -0600

berak gravatar image

Error when tring to train image with opencv and android

  public class MainActivity extends Activity {
Button button;

ImageView res4;
TextView T1;
private static final String TAG = "training";

private BaseLoaderCallback mLoaderCallBack = new BaseLoaderCallback(this) {
    public void onManagerConnected(int status) {
        switch (status) {
        case LoaderCallbackInterface.SUCCESS:
            Log.i(TAG, "Open CV loaded successfully");
            break;

        default:
            super.onManagerConnected(status);
            break;
        }
    };
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    setContentView(R.layout.activity_main);
    addListenerOnButton();

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public void onResume() {
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_1_0, this,mLoaderCallBack);

}



public void addListenerOnButton() {

//  imageView = (ImageView) findViewById(R.id.imageView1);

    res4 = (ImageView) findViewById(R.id.imageView2);
    button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(new OnClickListener() {



        @Override
        public void onClick(View arg0) {


                try {

                train();

            } catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }
        }

    });

}
public void train (){
        //Creating Training Data
     String path = Environment.getExternalStorageDirectory().toString();                  
     Mat trainData = new Mat(); 
     Mat response_array = new Mat();
    Mat img =Imgcodecs.imread("/storage/emulated/0/DCIM/Camera/n1.png");
    img.convertTo(img, CvType.CV_32FC1);
     Size dsize = new Size(50, 50); 
     Imgproc.resize(img, img, dsize);  
     img.convertTo(img, CvType.CV_32FC1);
     Mat imgResized = img.reshape(1, 1);   
     trainData.push_back(imgResized);
     Mat response = new Mat();
     Mat tmp; 
     tmp=response_array.reshape(1,1); //make continuous  `
     tmp.convertTo(response,CvType.CV_32FC1); // Convert  to float  
     KNearest knn = KNearest.create();
     knn.train(trainData,Ml.ROW_SAMPLE, response);

     //For Storing training data
    Bitmap bmpOut1 = Bitmap.createBitmap(trainData.cols(), trainData.rows(), Bitmap.Config.ARGB_8888);
    trainData.convertTo(trainData,CvType.CV_8UC1); 
    Utils.matToBitmap(trainData, bmpOut1);
    File file = new File(path);  
    file.mkdirs(); 
    File file1 = new File(path, "train.png"); 
    OutputStream fout = null;
     try {  fout = new FileOutputStream(file1); 
     BufferedOutputStream bos = new BufferedOutputStream(fout); 
     bmpOut1.compress(Bitmap.CompressFormat.PNG, 100, bos);
     bos.flush(); 
     bos.close();  
     bmpOut1.recycle(); 
     }
     catch (FileNotFoundException e) { e.printStackTrace(); }
     catch (IOException e) {e.printStackTrace();}

     //For Accessing training data in BMP file  

     BitmapFactory.Options o = new BitmapFactory.Options(); 
     o.inScaled = false;
     Bitmap blankBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.train,o);
     int trainWidth = blankBitmap.getWidth();
     int trainHeight = blankBitmap.getHeight();
     Mat trainData2 = new Mat();
     Utils.bitmapToMat(blankBitmap,trainData2); 
     Mat trainData3 = new Mat();
     Mat response3 = new Mat();

     Imgproc.cvtColor(trainData2,trainData2,Imgproc.COLOR_BGRA2GRAY); // 1. change the number of channels; 
     trainData2.convertTo(trainData3,CvType.CV_32FC1); 
     KNearest knn2 = KNearest.create();
     knn.train(trainData3,Ml.ROW_SAMPLE, response3);

}
 }

I get these errors .Please help me and also i don't know how can i recognize my code

04-14 11:57:29.550: I/art(7070): Ignoring second debugger -- accepting and dropping
04-14 11:57:43.890: D/PhoneWindow(9670): FMB *FMB* installDecor mIsFloating : false
04-14 11:57:43.890: D/PhoneWindow(9670): FMB *FMB* installDecor flags : 8454400
04-14 11:57:44.040: D/OpenGLRenderer(9670): Render dirty regions requested: true
04-14 11:57:44.100: D/PhoneWindow(9670): FMB *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
04-14 11:57:44.100: D/PhoneWindow(9670): FMB *FMB* isFloatingMenuEnabled return false
04-14 11:57:44.150: D/SRIB_DCS(9670): log_dcs ThreadedRenderer::initialize entered! 
04-14 11:57:44.150: I/Adreno-EGL(9670): <qegldrvapi_eglinitialize:379>: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: SKARAJGA_AU_LINUX_ANDROID_LA.BR.1.1.2_RB1.05.00.02.031.018+PATCH[ES]_msm8916_32_refs/tags/AU_LINUX_ANDROID_LA.BR.1.1.2_RB1.05.00.02.031.018__release_ENGG (I856e09677e)
04-14 11:57:44.150: I/Adreno-EGL(9670): OpenGL ES Shader Compiler Version: E031.25.03.02
04-14 11:57:44.150: I/Adreno-EGL(9670): Build Date: 04/06/15 Mon
04-14 11:57:44.150: I/Adreno-EGL(9670): Local Branch: 
04-14 11:57:44.150: I/Adreno-EGL(9670): Remote Branch: refs/tags/AU_LINUX_ANDROID_LA.BR.1.1.2_RB1.05.00.02.031.018
04-14 11:57:44.150: I/Adreno-EGL(9670): Local Patches: 112c106f3772623daa7b4181c6cf23491044ead1 Revert "Disable ASTC on A405"
04-14 11:57:44.150: I/Adreno-EGL(9670):                  58a118cb818fdc906095a49a90977c15f9d3b223 Remove ASTC
04-14 11:57:44.150: I/OpenGLRenderer(9670): Initialized EGL, version 1.4
04-14 11:57:44.180: D/OpenGLRenderer(9670): Get maximum texture size. GL_MAX_TEXTURE_SIZE is 4096
04-14 11:57:44.180: D/OpenGLRenderer(9670): Enabling debug mode 0
04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Service connection created
04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Trying to get library path
04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Trying to get library list
04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Library list: "null"
04-14 11:57:44.220: D/OpenCVManager/Helper(9670): First attempt to load libs
04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Trying to init OpenCV libs
04-14 11:57:44.220: D/OpenCVManager/Helper(9670): Trying to load library /data/app/org.opencv.engine-1/lib/arm/libopencv_java3.so
04-14 11:57:44.260: D/OpenCVManager/Helper(9670): OpenCV libs init was ok!
04-14 11:57:44.260: D/OpenCVManager/Helper(9670): First attempt to load libs is OK
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   videoio: Removing WinRT API headers by default
04-14 11:57:44.260: I/OpenCVManager/Helper(9670): General configuration for OpenCV 3.0.0 =====================================
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Version control:               3.0.0-6-gc1f114b-dirty
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Platform:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Host:                        Linux 3.13.0-53-generic x86_64
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Target:                      Linux 1 armv7-a
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     CMake:                       2.8.12.2
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     CMake generator:             Ninja
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     CMake build tool:            /usr/bin/ninja
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Configuration:               Release
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   C/C++:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Built as dynamic libs?:      NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     C++ Compiler:                /usr/bin/ccache /home/maksim/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ (ver 4.8)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     C++ flags (Release):         -fexceptions -frtti -fpic -Wno-psabi --sysroot=/home/maksim/android-ndk-r10e/platforms/android-8/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -fomit-frame-pointer -mfpu=neon -fvisibility=hidden -fvisibility-inlines-hidden -mthumb -fomit-frame-pointer -fno-strict-aliasing -O3 -DNDEBUG  -DNDEBUG
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     C++ flags (Debug):           -fexceptions -frtti -fpic -Wno-psabi --sysroot=/home/maksim/android-ndk-r10e/platforms/android-8/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -fomit-frame-pointer -mfpu=neon -fvisibility=hidden -fvisibility-inlines-hidden -marm -fno-omit-frame-pointer -fno-strict-aliasing -O0 -g -DDEBUG -D_DEBUG  -O0 -DDEBUG -D_DEBUG
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     C Compiler:                  /usr/bin/ccache /home/maksim/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     C flags (Release):           -fexceptions -fpic -Wno-psabi --sysroot=/home/maksim/android-ndk-r10e/platforms/android-8/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -fomit-frame-pointer -mfpu=neon -fvisibility=hidden -mthumb -fomit-frame-pointer -fno-strict-aliasing -O3 -DNDEBUG  -DNDEBUG
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     C flags (Debug):             -fexceptions -fpic -Wno-psabi --sysroot=/home/maksim/android-ndk-r10e/platforms/android-8/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -fomit-frame-pointer -mfpu=neon -fvisibility=hidden -marm -fno-omit-frame-pointer -fno-strict-aliasing -O0 -g -DDEBUG -D_DEBUG  -O0 -DDEBUG -D_DEBUG
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Linker flags (Release):      -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now 
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Linker flags (Debug):        -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now 
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Precompiled headers:         NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Extra dependencies:          z dl m log
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     3rdparty dependencies:       libjpeg libwebp libpng libtiff libjasper IlmImf tbb
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   OpenCV modules:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     To be built:                 hal core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d java stitching videostab
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Disabled:                    world
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Disabled by dependency:      -
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev python2 viz
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Android: 
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Android ABI:                 armeabi-v7a with NEON
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     STL type:                    gnustl_static
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Native API level:            android-8
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     SDK target:                  android-11
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Android NDK:                 /home/maksim/android-ndk-r10e (toolchain: arm-linux-androideabi-4.8)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     android tool:                /home/maksim/android-sdk-linux/tools/android (Android SDK Tools, revision 24.3.)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Google Play manager:         NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Android examples:            YES
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   GUI: 
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     GTK+:                        NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     GThread :                    NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     GtkGlExt:                    NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     OpenGL support:              NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     VTK support:                 NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Media I/O: 
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     ZLib:                        z (ver 1.2.3)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     JPEG:                        build (ver 90)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     WEBP:                        build (ver 0.3.1)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     PNG:                         build (ver 1.5.12)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     TIFF:                        build (ver 42 - 4.0.2)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     JPEG 2000:                   build (ver 1.900.1)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     OpenEXR:                     build (ver 1.7.1)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     GDAL:                        NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Video I/O:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Other third-party libraries:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Use IPP:                     NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Use Eigen:                   NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Use TBB:                     YES (ver 4.1 interface 6102)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Use OpenMP:                  NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Use GCD                      NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Use Concurrency              NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Use C=:                      NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Use pthreads for parallel for:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):                                  NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Use Cuda:                    NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Use OpenCL:                  NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Python 2:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Interpreter:                 /usr/bin/python2.7 (ver 2.7.6)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Python 3:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Interpreter:                 /usr/bin/python3.4 (ver 3.4)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Python (for build):            /usr/bin/python2.7
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Java:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     ant:                         /usr/bin/ant (ver 1.9.3)
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Java wrappers:               YES
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Java tests:                  YES
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Matlab:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     mex:                         NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Documentation:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Doxygen:                     NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     PlantUML:                    NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Tests and samples:
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Tests:                       YES
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     Performance tests:           NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):     C/C++ Examples:              NO
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   Install path:                  /home/maksim/workspace/android-pack/builds/o4a/install
04-14 11:57:44.260: I/OpenCVManager/Helper(9670):   cvconfig.h is in:              /home/maksim/workspace/android-pack/builds/o4a
04-14 11:57:44.260: I/OpenCVManager/Helper(9670): -----------------------------------------------------------------
04-14 11:57:44.260: D/OpenCVManager/Helper(9670): Init finished with status 0
04-14 11:57:44.260: D/OpenCVManager/Helper(9670): Unbind from service
04-14 11:57:44.270: D/OpenCVManager/Helper(9670): Calling using callback
04-14 11:57:44.270: I/training(9670): Open CV loaded successfully
04-14 11:57:44.350: I/Timeline(9670): Timeline: Activity_idle id: android.os.BinderProxy@b1290da time:401459329
04-14 11:57:52.950: D/ViewRootImpl(9670): ViewPostImeInputStage ACTION_DOWN
04-14 11:57:53.070: E/cv::error()(9670): OpenCV Error: Assertion failed (ssize.area() > 0) in void cv::resize(cv::InputArray, cv::OutputArray, cv::Size, double, double, int), file /home/maksim/workspace/android-pack/opencv/modules/imgproc/src/imgwarp.cpp, line 3208
04-14 11:57:53.070: E/org.opencv.imgproc(9670): imgproc::resize_11() caught cv::Exception: /home/maksim/workspace/android-pack/opencv/modules/imgproc/src/imgwarp.cpp:3208: error: (-215) ssize.area() > 0 in function void cv::resize(cv::InputArray, cv::OutputArray, cv::Size, double, double, int)
04-14 11:57:53.070: W/System.err(9670): CvException [org.opencv.core.CvException: cv::Exception: /home/maksim/workspace/android-pack/opencv/modules/imgproc/src/imgwarp.cpp:3208: error: (-215) ssize.area() > 0 in function void cv::resize(cv::InputArray, cv::OutputArray, cv::Size, double, double, int)
04-14 11:57:53.070: W/System.err(9670): ]
04-14 11:57:53.070: W/System.err(9670):     at org.opencv.imgproc.Imgproc.resize_1(Native Method)
04-14 11:57:53.070: W/System.err(9670):     at org.opencv.imgproc.Imgproc.resize(Imgproc.java:2716)
04-14 11:57:53.070: W/System.err(9670):     at com.example.nadiatrain.MainActivity.train(MainActivity.java:124)
04-14 11:57:53.070: W/System.err(9670):     at com.example.nadiatrain.MainActivity$2.onClick(MainActivity.java:103)
04-14 11:57:53.070: W/System.err(9670):     at android.view.View.performClick(View.java:5210)
04-14 11:57:53.070: W/System.err(9670):     at android.view.View$PerformClick.run(View.java:20976)
04-14 11:57:53.070: W/System.err(9670):     at android.os.Handler.handleCallback(Handler.java:739)
04-14 11:57:53.070: W/System.err(9670):     at android.os.Handler.dispatchMessage(Handler.java:95)
04-14 11:57:53.070: W/System.err(9670):     at android.os.Looper.loop(Looper.java:145)
04-14 11:57:53.070: W/System.err(9670):     at android.app.ActivityThread.main(ActivityThread.java:6145)
04-14 11:57:53.070: W/System.err(9670):     at java.lang.reflect.Method.invoke(Native Method)
04-14 11:57:53.070: W/System.err(9670):     at java.lang.reflect.Method.invoke(Method.java:372)
04-14 11:57:53.070: W/System.err(9670):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
04-14 11:57:53.070: W/System.err(9670):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)