Ask Your Question

rdasgupta's profile - activity

2016-01-22 12:13:33 -0600 received badge  Popular Question (source)
2014-02-28 05:57:28 -0600 received badge  Editor (source)
2014-02-28 05:13:34 -0600 commented question matlab bindings issue (call to cv doesn't work)

OpenCV 2.4.8 does not have provisions for Matlab bindings I believe. They are part of OpenCV 3.0 as of now. How did you compile the Matlab bindings for 2.4.8?

2014-02-28 04:36:41 -0600 commented question Compile MATLAB bindings for OpenCV

It seems that data type is not the problem. All the generated .m files corresponding to the Matlab bindings are just comments. There is no actual code in them. Apparently the compilation did not go properly, and the problem remains. :(

2014-02-28 04:35:22 -0600 commented question Matlab binding for cv.calcHist

I keep getting similar errors when trying to use any of the MATLAB bindings for OpenCV. Hope someone provides a solution to this!

2014-02-28 04:31:03 -0600 commented question Compile MATLAB bindings for OpenCV

How exactly would I convert a MATLAB image to CV_32F?

2014-02-28 04:09:50 -0600 asked a question Compile MATLAB bindings for OpenCV

I am trying to compile the MATLAB bindings for OpenCV 3.0, i.e. the current build from Github. I keep getting the following errors:

CMake Error at /opencv/modules/matlab/compile.cmake:47 (message):
  Failed to compile createCalibrateDebevec:
  /opencv/build/modules/matlab/src/createCalibrateDebevec.cpp:
  In function ‘void mexFunction(int, mxArray**, int, const mxArray**)’:

  /opencv/build/modules/matlab/src/createCalibrateDebevec.cpp:46:3:
  error: ‘Ptr_CalibrateDebevec’ was not declared in this scope

This occurs for multiple files. I found this thread, Issue 3445, which discusses a couple of remedies, viz. adding some typedefs to the bridge.hpp file, but that results in even more errors while compiling. I also found this thread which suggested removing the problematic .cpp files and compiling. This resulted in error-free compilation followed by the usual make install. However, calling any OpenCV function from inside MATLAB now results in errors such as:

If = cv.dft(I, 'flags', cv.DFT_COMPLEX_OUTPUT);
Error using dft
cv::exception caught:
/home/xxx/opencv-master/modules/core/src/dxt.cpp:1760: error: (-215)
type == CV_32FC1 || type == CV_32FC2 || type == CV_64FC1 || type == CV_64FC2
in function dft

Another error example:

im_denoise = cv.fastNlMeansDenoising(im_noise, 18);
Error using fastNlMeansDenoising
cv::exception caught:
/home/xxx/opencv-master/modules/photo/src/fast_nlmeans_denoising_invoker.hpp:146:
error: (-215) almost_dist2weight_[0] == fixed_point_mult_ in function
FastNlMeansDenoisingInvoker

Any help on how to resolve these issues is much appreciated!

2014-02-28 03:52:46 -0600 received badge  Scholar (source)
2014-02-28 03:52:45 -0600 received badge  Supporter (source)
2012-08-11 12:35:27 -0600 asked a question MSER Sample in OpenCV 2.4.2 on Visual Studio 2012

I'm running OpenCV 2.4.2, on Visual Studio 2012. I want to use MSER to detect text in images. I started off with the sample MSER sample program provided in the OpenCV directory,

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>

using namespace cv;
using namespace std;

static const Vec3b bcolors[] =
{
    Vec3b(0,0,255),
    Vec3b(0,128,255),
    Vec3b(0,255,255),
    Vec3b(0,255,0),
    Vec3b(255,128,0),
    Vec3b(255,255,0),
    Vec3b(255,0,0),
    Vec3b(255,0,255),
    Vec3b(255,255,255)
};

int main( int argc, char** argv )
{
    string path;
    Mat img0, img, yuv, gray, ellipses;

    img0 = imread( argc != 2 ? "puzzle.png" : argv[1], 1 );
    if( img0.empty() )
    {
        if( argc != 2 )
            cout << "\nUsage: mser_sample <path_to_image>\n";
        else
            cout << "Unable to load image " << argv[1] << endl;
        return 0;
    }

    cvtColor(img0, yuv, COLOR_BGR2YCrCb);
    cvtColor(img0, gray, COLOR_BGR2GRAY);
    cvtColor(gray, img, COLOR_GRAY2BGR);
    img.copyTo(ellipses);

    vector<vector<Point> > contours;
    double t = (double)getTickCount();
    MSER()(yuv, contours);
    t = (double)getTickCount() - t;
    printf( "MSER extracted %d contours in %g ms.\n", (int)contours.size(),
           t*1000./getTickFrequency() );

    // draw mser's with different colors
    for( int i = (int)contours.size()-1; i >= 0; i-- )
    {
        const vector<Point>& r = contours[i];
        for ( int j = 0; j < (int)r.size(); j++ )
        {
            Point pt = r[j];
            img.at<Vec3b>(pt) = bcolors[i%9];
        }

        // find ellipse (it seems cvfitellipse2 have error or sth?)
        RotatedRect box = fitEllipse( r );

        box.angle=(float)CV_PI/2-box.angle;
        ellipse( ellipses, box, Scalar(196,255,255), 2 );
    }

    imshow( "original", img0 );
    imshow( "response", img );
    imshow( "ellipses", ellipses );

    waitKey(0);
}

When I build and run this code, I get the following output after which the application stops responding:

 MSER extracted 1584 contours in 1748.41 ms.
 OpenCV Error: Assertion failed (points.checkVector(2) >= 0 && (points.depth() == 
 CV_32F || points.depth() == CV_32S)) in unknown function, file 
 ..\..\..\src\opencv\modules\imgproc\src\contours.cpp, line 2019

Any idea what exactly the problem is? I am totally lost!

I've tried commenting out everything inside the outer for loop, and it seems that the problem lies with the RotatedRect and fitEllipse portions. I'm not completely sure though.Any help would be much appreciated!

2012-08-11 09:32:00 -0600 commented answer How to used MSER in OpenCV2.4.2 to detect regions?

Whenever I try to run this code, I get an error message: OpenCV Error: Bad argument (Input array is not a valid matrix) in unknown function, file ......\src\opencv\modules\imgproc\src\utils.cpp, line 53 And then it stops responding! I'm using OpenCV 2.4.2, with Visual Studio 2012 RC. Any idea what's going wrong, and how I can fix it?