Ask Your Question

Medicasafe Inc.'s profile - activity

2019-05-13 19:10:49 -0600 received badge  Popular Question (source)
2014-05-16 12:15:20 -0600 commented question Using adaptative thresshold on android.

Thank you, issue resolved. The bitmap was actually a gray image but openCv seems that it´s considering all the images as RGB when using the BitmapToMat method, so I needed to se cvColor.

Thank you.

2014-05-15 18:03:42 -0600 asked a question Using adaptative thresshold on android.

I am trying to use an adaptative thresshold to binarize one image using the open cv library. The code is the following:

public Bitmap filter(Bitmap image){

    Log.d(TAG, " Filtering ... ");

    Mat inputMat = new Mat(image.getHeight(), image.getWidth(), CvType.CV_8U/*.CV_8UC1*/);
    Utils.bitmapToMat(image, inputMat);

    Mat inputMat2 = new Mat(image.getHeight(), image.getWidth(), CvType.CV_8U);     
    Mat outputMat = new Mat(image.getHeight(), image.getWidth(), CvType.CV_8U);

    Log.d(TAG, " Pre Filtering ... ");

    Imgproc.adaptiveThreshold(inputMat, outputMat, 50, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY, 5, 25);

    // Photo.fastNlMeansDenoisingColored(inputMat, outputMat);
    Log.d(TAG, " Filtering Done... ");

    Bitmap output = Bitmap.createBitmap(image.getWidth(), image.getHeight(), Bitmap.Config.RGB_565);
    Utils.matToBitmap(outputMat, output);

    return output;  
}

I had tried several types as CV_8UC1 or CV_8SC1, but all always cause the same error at executing the function:

05-16 00:50:33.125: E/AndroidRuntime(1892): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=102, result=-1, data=Intent { dat=content://media/external/images/media/15312 (has extras) }} to activity {com.medicasafe.images/com.medicasafe.images.ImageDecodingActivity}: CvException [org.opencv.core.CvException: cv::Exception: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/imgproc/src/thresh.cpp:796: error: (-215) src.type() == CV_8UC1 in function void cv::adaptiveThreshold(cv::InputArray, cv::OutputArray, double, int, int, int, double)

The method is executed in onActivityResult() after the user select one image from gallery.

2014-04-11 17:46:16 -0600 asked a question Open CV features

Hi,

I'm looking for a Android library which could allow me to make transformations in images like change the rotation and change the perspective. Do OpenCV have this features for Android OS?

I have seen some reference about other transformations, but as this library is used in a lot of OS I couldn't confirm it for Android.

Thank you