How to create OpenCV morphology filter Android in ADT/Eclipse ?

asked 2014-04-27 13:03:46 -0500

I 've made ​​an application that can be gained by means of capturing image and choose from the gallery .

  • Furthermore then stored in a variable of type bitmap data , the following is source code snippet :

image description  

  • Then I want to do image processing on the image , the image processing I wanted was morphology filter, which before effect there are some white dots on the license plates, then after effect white dots disappear, so that only display main objects, that is number of license plate as shown in the following picture :

image description

  • I 've imported the OpenCV library version 2.4.8 , the result in the image below :

image description

  • I 've also set my project will reference to the OpenCV library which I had previously imported . As follows:

image description

The problem that I am facing is as follows :

  • What I'm confused is how to write the function morphology into my Android application , I have absolutely no idea and confused , had a few days I was looking on the internet but no one gives a clear and detailed explanation

  • What if I export the application to the data type . Apk , whether the application will be running smoothly , I read some articles, that can be used for library OpenCV on Android devices must first be processed using the Android NDK , I also had to download version r9d latest Android NDK , I also had to set the editor ADT , as shown below :

image description

From the above discussion , I asked for help from the forum members to take the time to help me resolve this problem . I actually asked for help , I would be really happy if someone helps me , thank you very much ! ! !

To learn more, here is my full source code :

package com.example.threshold5;


import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.highgui.Highgui;
import org.opencv.imgproc.Imgproc;

import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.provider.MediaStore.Images.ImageColumns;
import android.content.Intent;
import android.database.Cursor;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class MainActivity extends Activity {

    protected static final String SourceGambar = null;
    Bitmap InputBitmap = null;
    ImageView OriginalImage;
    ImageView OutputImage;
    ImageView BinaryImage;
    Button ButtonMorphology;
    Button ButtonSelect;
    Button ButtonCapture;

    private int IntentPicture = 1;
    private int IntentCamera = 2;

    private Uri mImageCaptureUri;
    private ImageView mImageView;

    protected void onCreate(Bundle savedInstanceState) {

        OriginalImage =(ImageView) findViewById(;
        OutputImage =(ImageView) findViewById(;        
        ButtonMorphology = (Button) findViewById(;
        ButtonSelect = (Button) findViewById(;
        ButtonCapture = (Button) findViewById(;

        ButtonSelect.setOnClickListener(new View.OnClickListener() {
           public void onClick(View v) {
               Intent ImagePickerIntent = new Intent(Intent.ACTION_PICK ...
edit retag flag offensive close merge delete