Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 600

OpenCV: Replace ilLoadImage with cv::imread

$
0
0
I'm using [`hessgpu`][1] for efficiently compute hessian-affine SIFT descriptors using GPUs. In this project, [Devil][2] is used for reading images: if `SiftGPU::RunSIFT(const char *imgpath)` is called (implemented [here][3]), then [`ilLoadImage`][4] is used in [GLTexImage.cpp][5] for reading images (as RGB images). However, in my project I use [`cv::imread`][6] to read images. The project provides `SiftGPU::RunSIFT(int width, int height, const void * data, unsigned int gl_format, unsigned int gl_type)` to compute descriptors from data provided directly from the user. So I tried: cv::Mat img = cv::imread("image.jpg", cv::IMREAD_GRAYSCALE); sift.RunSIFT(img.cols, img.rows, img.data, GL_LUMINANCE, GL_UNSIGNED_BYTE); But this produce slightly less keypoints than `sift.RunSIFT("image.jpg");`. I tried to use: cv::Mat img = cv::imread("image.jpg"); sift.RunSIFT(img.cols, img.rows, img.data, GL_RGB, GL_UNSIGNED_BYTE); But this produces 0 keypoints, so something very wrong happens. I think: 1. `iLoadImage` uses RGB image, while the only working method that I found up to now using `cv::imread` works only with grayscale images. 2. It's possible that devil use a different process to read images than OpenCV, espcecially for RGB images (since using the second approach produced 0 keypoints). How can I do the equivalent of `ilLoadimage` using `cv::imread`? [1]: https://github.com/sloup/hessgpu [2]: http://openil.sourceforge.net/ [3]: https://github.com/sloup/hessgpu/blob/master/src/SiftGPU/SiftGPU.cpp [4]: https://www.google.it/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjT5qCXovvSAhWIzxQKHUJ3BdkQFggcMAA&url=http%3A%2F%2Fwww-f9.ijs.si%2F~matevz%2Fdocs%2FDevIL%2Fil%2Ff00039.htm&usg=AFQjCNFA86lmJX1CqzThnbEtvON2Yj69zg&sig2=UZevokqELZh7hBmEV5Pj8g [5]: https://github.com/sloup/hessgpu/blob/master/src/SiftGPU/GLTexImage.cpp [6]: http://docs.opencv.org/3.1.0/d4/da8/group__imgcodecs.html

Viewing all articles
Browse latest Browse all 600

Latest Images

Trending Articles



Latest Images