2013年12月6日金曜日

[OpenCV] SURF的使用

SIFT 和 SURF 從 2.4 版之後,被移動到 nonfree 裡面。

所以使用時必須加入下面的程式碼。

#include <opencv2/nonfree/nonfree.hpp>

#pragma comment(lib, "opencv_nonfree247d.lib")

#pragma comment(lib, "opencv_nonfree247.lib")


使用前須初始化

cv::initModule_nonfree();


2013年12月4日水曜日

2013年12月3日火曜日

[OpenCV] cv::Mat 與 IplImage 的轉換


cv::Mat → IplImage
IplImage *iplImage = cvLoadImage(imageFile, 1);

cv::Mat matImage(iplImage);


IplImage → cv::Mat
cv::Mat matImage(cv::Size(width, height), CV_8UC3);

IplImage *iplImage = cvCreateImage(cvSize(width, height), 8, 3);

iplImage = &matImage.operator IplImage();


[OpenGL] Windows 8.1 64bit 下的 OpenGL 於 Visual Studio 2012 的開發環境配置

跟 windows 7 的配置是一樣的。

這裡下載 glut-3.7.6-bin.zip。

解壓縮後將檔案如下方動作放至各資料夾中。

glut.h → C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\GL

glut.lib → C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib

glut32.dll → C:\Windows\SysWOW64


source file 中加入

#include <GL/gult.h>


應該就可以用了。

-----

另外是 freeglut的配置

這裡下載 freeglut 2.8.1 MSVC Package

配置方法同上方的OpenGL。


=====

troubleshoot

0xc000007b

The application was unable to start correctly (0xc000007b). Click OK to close the application.

檢查配置的 dll 是否正確。

32bit 的應用程式需對應 32bit 的 dll 檔,

64bit 的應用程式需對應 64bit 的 dll 檔。

但從下載來的freeglut中配置時出現錯誤的解法卻是將 32bit 的 dll 放入 64bit 的資料夾。