0

In my code, I don't want to read data from rout of images,such as

    cv::Mat img_1 = imread("F:\1.tif");

Instead I wanna read data from pointer:

    float* srcImage;//pointer to image data
    cv::Mat img_1(height, width, CV_32FC1, srcImage);

However, I found that, by this way, when I used the img_1 in the following ORB function, it didn't work

    cv::ORB orb;
vector<cv::KeyPoint> keyPoints_1;
cv::Mat descriptors_1;
orb(img_1, cv::Mat(), keyPoints_1, descriptors_1);

How can I pass data to Mat from pointer? Is there any difference between imread() function and pass data from pointer? Or, is there any special request in cv::ORB function ?

Thanks very much! I'm not familiar with OpenCV, I just start using it for a few weeks, I just need solve this problem and the rest part of my code depends on results of this part.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
lucky
  • 3
  • 3

1 Answers1

1

orb wants an 8bit grayscale image as input, not a CV_32FC1

berak
  • 39,159
  • 9
  • 91
  • 89
  • Thanks very much. I will try another feature detection function. – lucky Aug 14 '13 at 06:15
  • You don't need to try another feature detector (I presume this is what you mean by "another feature detection function"). ORB works just fine. You just have to convert the image to grayscale and pass it as argument to the matcher. If you don't want to alter the original image, create a temporary one that stores it but in grayscale. In many algorithms in computer vision it has been discovered that reducing the colour information does not only NOT give bad results but it also improves the performance (especially storage wise). – rbaleksandar May 06 '14 at 09:46