Ask Your Question

krammer's profile - activity

2017-12-07 17:49:36 -0500 received badge  Popular Question (source)
2017-11-04 01:27:13 -0500 received badge  Popular Question (source)
2015-12-05 04:06:52 -0500 received badge  Famous Question (source)
2015-08-03 10:55:52 -0500 received badge  Notable Question (source)
2015-06-24 17:13:41 -0500 received badge  Popular Question (source)
2015-03-05 07:03:29 -0500 asked a question Cannot generate matlab bindings in OpenCV


I am trying to compile OpenCV on 64bit ubuntu system having Matlab R2014b(64bit) with gcc 4.9.x.

I use the following cmake parameters:

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/home/siddharth/opencv-master/install -D OPENCV_EXTRA_MODULES=/home/siddharth/opencv-master/opencv_contrib-master -D MATLAB_ROOT_DIR=/home/siddharth/matlab -D WITH_IPP=off ..

But during the configuration, I get the following message:

Matlab: -- mex: /home/siddharth/matlab/bin/mex -- Compiler/generator: Not working (bindings will not be generated)

I have checked that I can compile mex files from within Matlab. All other modules are generated in the build directory except the matlab bindings. I have also seen the question: Bindings to access openCV from MATLAB do not generate. But no working solution is there.

I have put the output of cmake at

How can I proceed now ? (FYI, I don't have Computer Vision Toolbox in Matlab if that matters)

EDIT: I report same behaviour with both OpenCV-3.0.0 beta and opencv-master(from github).

2015-01-18 11:04:41 -0500 asked a question How to use KAZE features in opencv ?

I compiled opencv 3.0.0 beta. But how can I use KAZE features in opencv ?

2015-01-18 09:29:17 -0500 commented question Matlab binding compilation error in OS X

did you get any solution ?

2014-12-27 08:40:49 -0500 asked a question How to compile nonfree module in opencv 3.0 beta ?

I have compiled opencv using the instructions at

but there is no support for SIFT or SURF. I searched them in the install directory, but they are not there. I had tried the same instructions with opencv-2.4.9 and nonfree modules did compile. How to achieve the same with opencv 3.0 ?

2014-09-23 06:07:53 -0500 received badge  Nice Question (source)
2014-09-21 02:21:51 -0500 asked a question using SIFT source code in OpenCV ?

Is openCV using OpenSIFT. If yes, if I have to modify SIFT code for some of my research, should I use it from within OpenCV or directly use OpenSIFT ?

2014-07-29 04:16:18 -0500 asked a question Develop for OpenCV using an IDE


I have started studying OpenCV source code. I was just wondering can opencv be setup in an IDE for Development ? It helps in finding related classes and functions, somewhat easier. (I am using QtCreator but any IDE would ease the understanding of code)

2013-11-09 12:30:52 -0500 asked a question Why does opencv doesn't have PCA-SIFT ?

PCA-SIFT is very robust, comparable to SIFT and described by lesser dimensions than SIFT. Just wondering why it is not included in OpenCV.

2013-10-26 05:25:51 -0500 asked a question How to use PCA SIFT in opencv ?

How can I use [PCA-SIFT] with the usual datatypes used in OpenCV for feature matching like Keypoint ?

2013-10-26 01:00:58 -0500 asked a question Image matching using SIFT and BRIEF

I am trying to match images using SIFT keypoint detector and BRIEF descriptor. The matching is done using Flann LSHIndexParams. I give one image as input, and it is compared against 20 other images. To store the matched image, I use the drawMatches function. It works perfectly for a few of the images, but after a few iterations gives this error:

OpenCV Error: Assertion failed (i1 >= 0 && i1 < static_cast<int>(keypoints1.size ())) in drawMatches, file C:\OpenCV\opencv\modules\features2d\src\draw.cpp, line 207 terminate called after throwing an instance of 'cv::Exception' what(): C:\OpenCV\opencv\modules\features2d\src\draw.cpp:207: error: (-215) i1 >= 0 && i1 < static_cast<int>(keypoints1.size()) in function drawMatches

My code is as follows:


    #define NO_IMAGES 20
    std::vector<KeyPoint> keypoints;
     cv::Mat descriptors;

    // inside main
    Mat imageSource= imread("1.jpg");
    for(int i = 1; i <= NO_IMAGES; i++)
        Mat image1 = imread(pathImage.arg(i).toStdString());
        Mat image;
        resize(image1, image, Size(256,256)/*new dimensions*/,0, 0, INTER_AREA/* interpolation method*/);
        matchFeatures(imageSource, image,i );                        

  // calculate features of input image
  void calculateSourceFeatures(Mat image)
cv::Ptr<FeatureDetector> featureDetector = cv::FeatureDetector::create("SIFT");
featureDetector->detect(image, keypoints);
cv::Ptr<DescriptorExtractor> featureExtractor = cv::DescriptorExtractor::create("BRIEF");
featureExtractor->compute(image, keypoints, descriptors);


void matchFeatures( Mat image, Mat target, int imageNo)
cv::Mat descriptors1;
std::vector<KeyPoint> keypoints1;

cv::Ptr<FeatureDetector> featureDetector = cv::FeatureDetector::create("SIFT");
cv::Ptr<DescriptorExtractor> featureExtractor = cv::DescriptorExtractor::create("BRIEF");
featureDetector->detect(target, keypoints1);
featureExtractor->compute(target, keypoints1, descriptors1);

cv::Ptr<cv::FlannBasedMatcher> matcher = new cv::FlannBasedMatcher(new     cv::flann::LshIndexParams(5, 24, 2));

std::vector< DMatch > matches;
matcher->match( descriptors, descriptors1, matches );

double max_dist = 0; double min_dist = 100;

for( int i = 0; i < descriptors.rows; i++ )
{ double dist = matches[i].distance;
  if( dist < min_dist ) min_dist = dist;
  if( dist > max_dist ) max_dist = dist;
std::vector< DMatch > good_matches;

for( int i = 0; i < descriptors.rows; i++ )
  if( matches[i].distance <= 2*min_dist )
      good_matches.push_back( matches[i]);

Mat img_matches;
// Error comes here after few iterations
drawMatches( image, keypoints, target, keypoints1,
             good_matches, img_matches, Scalar::all(-1), Scalar::all(-1),
             vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );

QString filename = "SIFTBRIEF_" + QString::number(imageNo) + ".jpg";
imwrite(filename.toStdString(), img_matches);


2013-09-06 13:39:35 -0500 asked a question How to Determine perspective transform between two images

I have transformed an image by using affine transform by using the function getAffineTransform() by manually passing 3 points for each image. (i.e. I know the affine transform)

Now, I would like to obtain a homogenous matrix of the transform. How is it possible ? The reason, I am doing it is that I am trying to determine the false positives by extracting the features using SURF and matching using FLANN based Matcher . So, if I can get the homogenous transform between the two images, I can just compare the output of warpperspective on original keypoints and the matched keypoints.

2013-09-06 10:53:47 -0500 asked a question unknown dot on using FileStorage to write Mat

I am using the following code to store Mat(SURF features) to a file

  cv::Mat descriptors;
  featureExtractor->compute(image, keypoints, descriptors);
  FileStorage fs("features.yml", FileStorage::WRITE);

for reading the file, I use

FileStorage fs;"features.yml", FileStorage::READ);
Mat m;
fs["oriimage"] >> m;

The Mat is stored and read as: {3., 6., 0., 0., 0., 0., 3., 2., 0., 0., 34.} //Note the .(dot) at the end of each number

while before storing if I do cout << descriptors, it prints the same numbers without the dots.

What is wrong with my code ?

2013-09-03 05:26:39 -0500 received badge  Student (source)
2013-09-02 10:57:16 -0500 asked a question What does function evaluateFeatureDetector do ?


I was looking at the descriptor extractor matcher tutorial . There a function is used "evaluateFeatureDetector" which calculates repeatibility and correspondence point. What exactly this function does, I am not able to find any reference in the documentation as well.

2013-09-02 10:53:03 -0500 commented answer how to achieve Similarity Transform ?

thanks. I have tried getAffineTransform(). Is it possible to get homogenous matrix from it ?

2013-09-02 10:52:04 -0500 received badge  Scholar (source)
2013-09-02 10:51:49 -0500 received badge  Supporter (source)
2013-09-01 11:25:42 -0500 received badge  Editor (source)
2013-09-01 10:18:35 -0500 asked a question how to achieve Similarity Transform ?


I have been able to transform an image using affine transform and perspective transform using the affine transformation tutorial. I have also been able to rotate an image using getRotationMatrix2D. But how can I translate an image ?