Ask Your Question

[email protected]'s profile - activity

2017-06-02 21:26:13 -0600 asked a question Example of SparsePyrLKOpticalFlow

Hello,

I'm trying to refactor old code which uses "cvCalcOpticalFlowPyrLK" (http://docs.opencv.org/2.4/modules/vi...). With new cuda function cv::cuda::SparsePyrLKOpticalFlow::calc but I cannot find any example of usage.

Can anyone please post me some example of correct use of this method, (of all the input structures and what should I receive)?

Thanks a lot

2017-05-25 15:35:05 -0600 asked a question Integral image wrong values

Hello,

I'm trying to use cuda::integral method but it keeps on giving me wrong values. Here's my code:

void VarianceFilter::CUDA_nextIteration(const cv::cuda::GpuMat &img)
{
    bool OpencvIntegral = true;
    if (!enabled) return;

    CUDA_release();

    if (OpencvIntegral)
    {
        cv::Mat temp, temp2, temp3;
        CUDA_integralImg = cv::cuda::GpuMat(temp.cols +1 , temp.rows+1 , CV_32SC1);
        cuda::integral(img, CUDA_integralImg);
        cuda::sqrIntegral(img, CUDA_integralImg_squared);

        img.download(temp);
        CUDA_integralImg.download(temp2);
        CUDA_integralImg_squared.download(temp3);

        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                printf(" %d", temp.at<char>(i, j));
            }
            printf("\n");
        }
        printf("\n");

        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                printf(" %d", temp2.at<char>(i, j));
            }
            printf("\n");
        }
        printf("\n");
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                printf(" %d", temp3.at<char>(i, j));
            }
            printf("\n");
        }

}

And the results that I'm receiving :

Results

As you can see the values on integralImage aren't correct. They should be counted like this:

Integral Images pattern

I will appreciate if you could point out my mistake, Thanks a lot

2017-05-24 14:50:11 -0600 asked a question Very big pixel values

Greetings,

I'm trying to use cuda::integral method on a video(converting every frame to GpuMat and do some processing on them) but the values of pixels that I'm getting are so high, that after using integral method, the pixel values of integral image are just too high(over the limits of INT -> so they're becoming zeros.).

Here's some example code that I'm trying to use. Can anyone point me my mistake? Why are the values so high? [code]

void VarianceFilter::CUDA_nextIteration(const cv::cuda::GpuMat &img)
{
    if (!enabled) return;

    CUDA_release();

    if (OpencvIntegral)
    {
        cv::Mat temp, temp2;
        img.download(temp);
        printf("type is = %s \n", type2str(img.type()));

        CUDA_integralImg = cv::cuda::GpuMat(temp.cols + 1, temp.rows + 1, CV_32SC1);
        cuda::integral(img, CUDA_integralImg);
        CUDA_integralImg.download(temp2);

        printf("[0,0] = %d  - integral = %d \n", temp.at<int>(0, 0), temp2.at<int>(0, 0));
        cuda::sqrIntegral(img, CUDA_integralImg_squared);
    }
}

[/code]

Example frame which I want to process(the "img" in the code.): Example frame

And the values which I print: Results

Thanks a lot in advance for the help.