Ask Your Question

DDS_Mytheral's profile - activity

2015-08-27 15:10:32 -0500 asked a question Converting pixel data from MatLab to something useable in OpenCV4Android

So I have a bunch of data from MatLab in a 16bit format... Values like Red: 42676, Green: 60145, Blue: 38758 and I'm trying to convert it to something usable in OpenCV as my values coming back are like 238.38.

I'm at a bit of a loss how to make those numbers match up... Any idea's on how to convert the MatLab data would be appreciated.

edit: Is it as simple as dividing by 256?

2015-08-10 16:21:54 -0500 asked a question OpenCV4Android - Can you edit contours?

So I've found contours but because of a lack on contrast in my image some of the contours I'm finding aren't what I'm expecting. So is there any way of editing a found contour?

I'm looking for a dot on an image and sometimes due to the lack of contrast it grabs most of the dot then proceeds to wrap around the rest of the image... Is there any way of manually fixing my contours?

2015-08-05 12:18:54 -0500 received badge  Scholar (source)
2015-08-04 12:32:34 -0500 commented answer Isolating a change in color in OpenCV.

The minval method is nice for showing a change but I just wanted some clarification. You said -28 would show up as 227 and I'm assuming a positive 28 would still show up as 28.

2015-08-04 07:41:08 -0500 commented question Isolating a change in color in OpenCV.

With HSV wouldn't you still need the average for the H, S & V values individually?

2015-08-03 18:58:26 -0500 asked a question Isolating a change in color in OpenCV.

So I've been attempting some image manipulation and I've come across a problem which seems simple but I can't seem to wrap my head about.

How do you isolate a change in color?

Say you have a grey colored dot with a value of Red 100, Green 100, Blue 100

Then you put a blue overlay with values of R 4, G 10, B 251 with 50% opacity on that dot and end up with values of Red 72, Green 74, Blue 124

So the change is roughly Red -28, Green -26, Blue +24

The best Idea I have is to only take the positive values but even that seems wrong as R 0, G 0, B 24 is a far cry from R 4, G 10, B 251.

Is there a stupid easy function I'm missing or am I just over thinking it?

2015-07-30 09:30:01 -0500 asked a question OpenCV4Android - Averaging Pixels inside a contour.

A quick Google search is coming up with the lack of a method for dealing with the pixels inside a contour.

Is there a preferred method for getting data out of a non-rectangle contour?

2015-07-29 13:38:53 -0500 asked a question OpenCV4Android - finding Contours on a Submat

I have an image with a bunch of dots on it and they test various things like humidity and PH.

So I have my larger image split up into a grid and I want to evaluate each dot one by one.

Getting a submat is easy and even the threshold seems to work well but when I go to get the contours is where I have problem.

Thresholded Image

image description

The contouring seems to "work" but instead of finding the big black dot it's finding one small contour that doesn't even show up when calling drawContours

public Mat findImageContours(Mat image)
{
    Mat intialImage = image.clone();

    /* Get contours from threshold image */
    List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
    Imgproc.findContours(intialImage, contours, mHierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);

    for (int i = 0; i < contours.size(); i++)
    {
        Scalar CONTOUR_COLOR = new Scalar(0, 255, 0);

        Log.e(TAG, "Contours count: " + contours.size());
        Imgproc.drawContours(intialImage, contours, -1, CONTOUR_COLOR);
    }

    contouredInit = intialImage.clone();
    return intialImage;
}

Any help is appreciated.

2015-07-14 13:25:49 -0500 commented question Android4OpenCV - Reduce() : Unsupported format or combination of formats

@berak The Row/Col incorrectly specified was an issue but it's still crashing with the same error... Updated above code.

2015-07-14 12:56:42 -0500 asked a question Android4OpenCV - Reduce() : Unsupported format or combination of formats

So I'm trying to use the Reduce() function to get row and column summations but I've hit a snag. It's crashing and telling me that there is an unsupported combinations of formats.

Unsupported combination of input and output array formats in function void cv::reduce(cv::InputArray, cv::OutputArray, int, int, int)

I've looked at this thread: http://answers.opencv.org/question/36...

That says you have to specify CvType which I've done but I'm still encountering an error.

Does Reduce not work with 8UC3 images? Or is there something else I am missing?

Any help is appreciated.

image description

OpenCV Error: Unsupported format or combination of formats (Unsupported combination of input and output array formats) in void cv::reduce(cv::InputArray, cv::OutputArray, int, int, int), file /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/matrix.cpp, line 2365

E/org.opencv.core﹕ core::reduce_10() caught cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/matrix.cpp:2365: error: (-210) Unsupported combination of input and output array formats in function void cv::reduce(cv::InputArray, cv::OutputArray, int, int, int)

E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.android.BluetoothChat, PID: 6166
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.BluetoothChat/com.example.android.BluetoothChat.AnalysisActivity}: CvException [org.opencv.core.CvException: cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/matrix.cpp:2365: error: (-210) Unsupported combination of input and output array formats in function void cv::reduce(cv::InputArray, cv::OutputArray, int, int, int)
    ]
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: CvException [org.opencv.core.CvException: cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/matrix.cpp:2365: error: (-210) Unsupported combination of input and output array formats in function void cv::reduce(cv::InputArray, cv::OutputArray, int, int, int)
    ]
            at org.opencv.core.Core.reduce_0(Native Method)
            at org.opencv.core.Core.reduce(Core.java:6661)
            at com.example.android.BluetoothChat.TemplateMatching.findGrid(TemplateMatching.java:396)
            at com.example.android.BluetoothChat.TemplateMatching.runIt(TemplateMatching.java:660)
            at com.example.android.BluetoothChat.TemplateMatching.<init>(TemplateMatching.java:574)
            at com.example.android.BluetoothChat.AnalysisActivity.onCreate(AnalysisActivity.java:71)
            at android.app.Activity.performCreate(Activity.java:5933)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
            ... 10 more
2015-07-14 12:53:46 -0500 received badge  Supporter (source)
2015-07-14 10:20:17 -0500 received badge  Enthusiast
2015-07-13 10:28:57 -0500 commented question OpenCV4Android - Reduce function?

Working like a charm. Thanks much.

For some reason I was thinking it was a separate package that needed to be imported.

2015-07-13 09:47:24 -0500 commented question OpenCV4Android - Reduce function?

I did look at that but when I get to the code I can't import org.opencv.core.Core.reduce. It does know org.opencv.core.Core but it's only seeing MinMaxLocResult under that.

2015-07-09 15:50:19 -0500 asked a question OpenCV4Android - Reduce function?

So I know that C, C++ and Python have the reduce function: http://docs.opencv.org/modules/core/d...

But I can't seem to get it working on Android with OpenCV4Android. I'm not getting any autocomplete for it in Android Studio so I assume I need to import something or directly specify which package it's in.

Can anyone know what include it needs? Or perhaps a tutorial for it or otherwise just shine some light on this?

2015-07-08 13:02:45 -0500 commented question Equivlant to Matlab Sum Segmentation

Basically it just adds up the number of pixels in each row and column. Generally you run a blackhat filter on the image then use sum segmentation mask to add up each non-transparent pixel. From that you can use those sums to form a grid.

2015-07-08 10:47:05 -0500 received badge  Student (source)
2015-07-08 09:09:50 -0500 asked a question Equivlant to Matlab Sum Segmentation

Using Sum Segmentation in Matlab you can turn this:

image description

Into this:

image description

Which is my first step in creating a best fit grid for the dot array. Normally I'd just impose a grid over the dots but the dots positions are somewhat random as they are placed by hand. The fact they are placed by hand means I need to create a "Best Fit Grid" to properly segment the image.

So does OpenCV have a "Sum Segmentation" fuction or if not is there another way I can go about this?

2015-07-01 15:39:19 -0500 received badge  Editor (source)
2015-07-01 14:46:26 -0500 asked a question OpenCV4Android - Image Blank After Using MorphologyEX

So I'm attempting to get a BlackHat Morph of an image but after applying the Morph operation I'm getting a Blank image and I'm not sure why.

Code:

private coid convertToBlackHat( Mat passedImage )
    {
        // Create a structuring element (SE)
    int morph_size = 100;
    Mat element = Imgproc.getStructuringElement( Imgproc.MORPH_RECT, new Size( 2*morph_size + 1, 2*morph_size+1 ), new Point( morph_size, morph_size ) );

    Mat dst = new Mat(); // result matrix
    // Apply the specified morphology operation
    Imgproc.morphologyEx( passedImage, dst, MORPH_TOPHAT, element, Point(-1,-1));   


    mBlackhatOutput = dst.clone();
}

The image is a 24-Bit jpeg at 1920x1080 with 100px circles on it.