Ask Your Question

Astor's profile - activity

2012-12-25 07:40:53 -0600 received badge  Nice Answer (source)
2012-12-09 09:03:07 -0600 commented question Import OpenCV for android in Eclipse

make sure that you import library correctly.

2012-11-21 12:05:47 -0600 commented question Problem working with Native Apps

show us logcat output.

2012-10-27 09:53:57 -0600 received badge  Critic (source)
2012-10-24 12:35:56 -0600 received badge  Scholar (source)
2012-10-24 08:04:34 -0600 received badge  Teacher (source)
2012-10-24 02:37:11 -0600 received badge  Self-Learner (source)
2012-10-22 15:38:01 -0600 answered a question Clusterization in OpenCV

I decided to answer my own question. On the first question I found answer by myself, and solution to the second question from my question on StackOverflow. Thanks @remi. So:

  1. It seems that inRange with special parameters will help me to achieve this, but the problem is that in this solution I will have call it k times, so simple iterating with check will do the trick. Also I can use check:

    cv::Mat mask = (labelImage == k)

  2. Here's full code (maybe someone will find it useful):


void kmeansMask(const Mat& src, const Mat& mask, const int k, Mat& dst)
{
    Mat tmp = Mat::zeros(countNonZero(mask), 1, CV_8UC3);
    int counter = 0;
    for (int r = 0; r < mask.rows; ++r)
    {
        for (int c = 0; c < mask.cols; ++c)
        {
            if (mask.at<unsigned char>(r, c))
            {
                tmp.at<cv::Vec3f>(counter++, 0) = src.at<cv::Vec3b>(r, c);
            }
        }
    }

    Mat labels;
    kmeans(tmp, k, labels, TermCriteria(), 1, KMEANS_RANDOM_CENTERS);

    dst = cv::Mat(mask.size(), CV_32S, k);
    counter = 0;
    for (int r = 0; r < mask.rows; ++r)
    {
        for (int c = 0; c < mask.cols; ++c)
        {
            if (mask.at<unsigned char>(r, c))
            {
                dst.at<int>(r, c) = labels.at<int>(counter++, 0);
            }
        }
    }
}
2012-10-12 15:16:01 -0600 commented question Cannot set user parameters in BackgroundSubtractorMOG2

It's not private - it's protected. It's a different thing (see encapsulation).

2012-10-12 15:07:53 -0600 asked a question Clusterization in OpenCV

I have a two questions about clusterization in OpenCV. I'm using kmeans clustering.

  • How to get mask of each post-clusterized layer of image? To understand this question I want to show an example. If I clusterize image on 3 clusters and after clusterisation I have this image:

output

(white is first cluster, gray is second and black - third).

So after splitting my aim is to get these three masks:

White: , gray: and black: .

  • What is the fastest way to clusterize only some part of image (I have two images - original image and mask image)? So, for example, if I clusterize image on n clusters after clusterization with mask I want to have n+1 cluster (+1 because of mask).

I'm looking for the fastest solutions of these problems.

Thanks in advance.

2012-09-19 09:51:44 -0600 received badge  Nice Question (source)
2012-07-29 04:05:14 -0600 commented answer Another way to use camera

Sounds good! Can you post link to tutorial or code? Because I'm new in Android development.

2012-07-29 04:03:53 -0600 commented question Another way to use camera

Thanks Kirill to your answer. Just type in Google Market "OpenCV" and choose any of founded results. And, yes, these applications worked on my motorola. Actually I was a bit wrong - their perfomance isn't much higher then my application. But anyway looking for a good way to boost application.

2012-07-29 03:59:53 -0600 received badge  Supporter (source)
2012-07-27 13:55:29 -0600 received badge  Student (source)
2012-07-27 13:06:35 -0600 received badge  Editor (source)
2012-07-27 13:06:14 -0600 asked a question Another way to use camera

I'm developing Android project that uses device camera as image input. I decided to use OpenCV native (c++) interface because of perfomance.

My test (and personal) device is Mororola Defy. Unfortunatelly there's a known issue that Motorola (and some other) devices have black screen even on non-native (basic) samples.

Fortunatelly there's known fix of that problem. And it worked fine for me.

The problem is that perfomance of such method is very low - I have simple application (no image processing, just showing image on device screen) and it has 5fps on both Motorola Defy and Sony Ericsson Arc S (image size is 640x480).

So my quesion is very simple - is there any other way of fixing that problem? Or the only solution for me now is to wait for the bugfix? In Android Marker I've seen apps that use OpenCV library and their perfomance is actually good.

Thanks for any advice!