ocl-mali-bug.cpp

source code to reproduce - Nicu Stiurca, 2014-11-18 06:29 am

Download (877 Bytes)

 
1
#include <iostream>
2
#include <vector>
3
#include <opencv2/core/core.hpp>
4
#include <opencv2/highgui/highgui.hpp>
5
#include <opencv2/ocl/ocl.hpp>
6
#include <opencv2/nonfree/ocl.hpp>
7
8
using namespace std;
9
using namespace cv;
10
using namespace cv::ocl;
11
12
const char * img_fname = "image_1409187896.603828323.bmp";
13
14
int main(int argc, char **argv)
15
{
16
  Mat image = imread(img_fname, CV_LOAD_IMAGE_GRAYSCALE);
17
18
  if(!image.data) {
19
    cerr << "Could not open image " << img_fname << endl;
20
    return -1;
21
  }
22
23
  oclMat image_ocl(image);
24
25
  ::cv::ocl::SURF_OCL surf_ocl(800.0, 4, 2, false);
26
27
28
  oclMat mask_ocl, descriptors_ocl;
29
  Mat descriptors;
30
  vector<KeyPoint> key_points;
31
32
  surf_ocl(image_ocl, mask_ocl, key_points, descriptors_ocl);
33
34
  descriptors = (Mat)descriptors_ocl;
35
36
  cout << "Got " << descriptors.rows << " " << descriptors.cols << "-dim descriptors" << endl;
37
38
  return 0;
39
}
40