Ask Your Question

razgriz's profile - activity

2018-04-16 08:11:08 -0600 asked a question Running Human Eva Dataset gives a Segmentation Fault in Linux

Running Human Eva Dataset gives a Segmentation Fault in Linux I've downloaded both the Human Eva Datasets, followed the

2018-04-01 20:10:04 -0600 commented answer how to run humaneva dataset in Opencv

Hi! I was able to get the tar files for the HumanEva_1, and following the instructions, I was able to "link" the tar fil

2018-04-01 05:56:58 -0600 commented answer how to run humaneva dataset in Opencv

Hi! I was able to get the tar files for the HumanEva_1, and following the instructions, I was able to "link" the tar fil

2015-06-07 21:36:30 -0600 asked a question Android OpenCV - Detecting circles of a color gives “image must be 8-bit single-channel in HoughCircle” Error?

Good day. Sorry for the long title, I even had to cut it down since I was exceeding the 150 character limit.

I am building an Android Application and I want to be able to detect black circles. I am using OpenCV3 for Android and I am able to filter out the black colours from my camera feed using the code below. Kindly note that I used the Color-blob-detection example given in the Android SDK and tweaked the code as such:

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    mRgba = inputFrame.rgba();

    if (mIsColorSelected) {

        Bitmap resultBitmap;

        resultBitmap = Bitmap.createBitmap(mRgba.cols(), mRgba.rows(),Bitmap.Config.ARGB_8888);
        Utils.matToBitmap(mRgba, resultBitmap);

        //TODO - look for circles
        Mat mat = new Mat(resultBitmap.getWidth(), resultBitmap.getHeight(), CvType.CV_8UC1);
        Utils.bitmapToMat(resultBitmap, mat);

        final Bitmap bitmap;

        //TODO - filter out the black only
        Mat mHSV = mat;
        Mat mHSVThreshed = mat;
        Mat mRgba2 = mat;

        Imgproc.cvtColor(mat, mHSV, Imgproc.COLOR_BGR2HSV, 0);
        Core.inRange(mHSV, new Scalar(0, 0, 0), new Scalar(130, 130, 130), mHSVThreshed);
        Imgproc.cvtColor(mHSVThreshed, mat, Imgproc.COLOR_GRAY2BGR, 0);
        Imgproc.cvtColor(mat, mRgba2, Imgproc.COLOR_BGR2RGBA, 0);

        Imgproc.GaussianBlur(mRgba2, mRgba2, new Size(9, 9), 2, 2);

        //this is for displaying purposes only. 
        //At this point, the image would be black and white, where the white spots are the black detected blobs 
        //            Bitmap bmp = Bitmap.createBitmap(mRgba2.cols(), mRgba2.rows(), Bitmap.Config.ARGB_8888);
        //Utils.matToBitmap(mRgba2, bmp);
       //bitmap = bmp; //resultBitmap;

        //TODO - new circle detection code: this uses the colour filtered Mat
        mat = mRgba2;
        Imgproc.HoughCircles(mat, circles,
                Imgproc.CV_HOUGH_GRADIENT, 1, minDist, 100,
                20, 0, 0);

        /* get the number of circles detected */
        int numberOfCircles = (circles.rows() == 0) ? 0 : circles.cols();

        /* draw the circles found on the image */
        for (int i = 0; i < numberOfCircles; i++) {

        /* get the circle details, circleCoordinates[0, 1, 2] = (x,y,r)
         * (x,y) are the coordinates of the circle's center
         */

            double[] circleCoordinates = circles.get(0, i);

            int x = (int) circleCoordinates[0], y = (int) circleCoordinates[1];

            Point center = new Point(x, y);
            int radius = (int) circleCoordinates[2];

            /* circle's outline */
            Imgproc.circle(mRgba2, center, radius, new Scalar(0,
                    200, 255), 4);

            /* circle's center outline */
            Imgproc.rectangle(mRgba2, new Point(x - 5, y - 5),
                    new Point(x + 5, y + 5),
                    new Scalar(0, 200, 255), -1);
        }
        Utils.matToBitmap(mRgba2, resultBitmap);

        bitmap = resultBitmap;

        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                mOpenCvCameraView.disableView();
                mOpenCvCameraView.setVisibility(SurfaceView.GONE);
                imageView.setVisibility(View.VISIBLE);
                imageView.setImageBitmap(bitmap);
            }
        });
    }
    return mRgba;
}

What my code does is that it takes a snapshot of the camera feed as a Mat, and then using that Mat, I do some image processing on it and to black out everything except the black colour. The resulting Mat is the mRgba2 variable and I converted to Bitmap and displayed on an ImageView. I displayed this Bitmap to confirm that I am getting the result I want.

After I know that I'm able to filter out the colour I wanted, I then run a GaussianBlur on it then proceed to run HoughCircles. However, when I run the

Imgproc ...
(more)
2015-06-06 00:14:53 -0600 received badge  Enthusiast
2015-05-31 01:00:04 -0600 asked a question Android OpenCV - Native Camera Library for Android 5 onwards?

Good day. I am using Android OpenCV for my Android application. I used the color blob detection as an example, however, I noticed that the OpenCV Camera "stretches" the video feed. Kindly refer to my StackOverflow question for screenshots supporting my claims regarding this issue..

I then decided to use the Native Camera View instead of the OpenCV Camera View. It works fine on devices that ran Android 4.0-4.4, however, when I ran it on my Nexus 5, running Android Lollipop (5.0), I was given the "It seems that your device does not support camera (or it is locked)." Error. I have the camera permissions in my Android Manifest. I then checked the files in the libs folders, and then I noticed that I had the libnative_camera_r2.2.0.so until libnative_camera_r4.4.0.so, I inferred that the rx.x.x.so refers to the version number, and the reason why it does not work is because there's no native camera library for Android 5.0.

My question now is:

When will a libnative_camera_r5.0.0.so be released? I just can't use a lower version because I am also using some features unique to Android Lollipop.