이거따라해서 성공함 http://blog.naver.com/action713/220067503533
참고.
윈도우8에서 VS2010과 openCV가 설치되었다고 생각하고.
(http://blog.naver.com/action713)
openCV를 사용하기 위해서 기본 환경 설정을 해줘야 한다고 한다.
프로젝트 설정
1. include path 설정
2. library path설정
3. library path설정
4. library 목록설정
*
1. VS2010에서 [파일] - [새로만들기] - [프로젝트] 선택
2. C++, Win32 콘솔 응용프로그램을 선택하고 프로젝트 이름 지정 후 확인버튼을 누른다.
3. 마침버튼을 누른다.(다음 X)
4. [프로젝트] - [속성] 선택 (Alt + F7)
5. 구성속성 - C/C++ - 일반 - 추가포함 디렉터리에 include경로 추가 <왼쪽 상단에 구성을 모든 구성으로 변경하는게 좋을 것 같다.>
ex) C:\opencv\build\include
6. 구성속성 - 링커 - 일반 - 추가 라이브러리 디렉터리에 lib경로 추가
ex) C:\opencv\build\x64\vc10\lib
7. 구성속성 - 링커 -입력 - 추가 종속성 <오른쪽 삼각형 누르고 <편집..>선택하면 편하다>
ex)
2.3.1
opencv_calib3d231.lib
opencv_contrib231.lib
opencv_core231.lib
opencv_features2d231.lib
opencv_flann231.lib
opencv_gpu231.lib
opencv_highgui231.lib
opencv_imgproc231.lib
opencv_legacy231.lib
opencv_ml231.lib
opencv_objdetect231.lib
opencv_ts231.lib opencv_video231.lib |
opencv_calib3d231d.lib
opencv_contrib231d.lib
opencv_core231d.lib
opencv_features2d231d.lib
opencv_flann231d.lib
opencv_gpu231d.lib
opencv_highgui231d.lib
opencv_imgproc231d.lib
opencv_legacy231d.lib
opencv_ml231d.lib
opencv_objdetect231d.lib
opencv_ts231d.lib opencv_video231d.lib |
2.4.7
opencv_calib3d247.lib
opencv_contrib247.lib opencv_core247.lib opencv_features2d247.lib opencv_flann247.lib opencv_gpu247.lib opencv_highgui247.lib opencv_imgproc247.lib opencv_legacy247.lib opencv_ml247.lib opencv_nonfree247.lib opencv_objdetect247.lib opencv_ocl247.lib opencv_photo247.lib opencv_stitching247.lib opencv_superres247.lib opencv_ts247.lib opencv_video247.lib opencv_videostab247.lib |
opencv_calib3d247d.lib opencv_contrib247d.lib opencv_core247d.lib opencv_features2d247d.lib opencv_flann247d.lib opencv_gpu247d.lib opencv_highgui247d.lib opencv_imgproc247d.lib opencv_legacy247d.lib opencv_ml247d.lib opencv_nonfree247d.lib opencv_objdetect247d.lib opencv_ocl247d.lib opencv_photo247d.lib opencv_stitching247d.lib opencv_superres247d.lib opencv_ts247d.lib opencv_video247d.lib opencv_videostab247d.lib |
opencv_calib3d249.lib
opencv_contrib249.lib
opencv_core249.lib
opencv_features2d249.lib
opencv_flann249.lib
opencv_gpu249.lib
opencv_highgui249.lib
opencv_imgproc249.lib
opencv_legacy249.lib
opencv_ml249.lib
opencv_nonfree249.lib
opencv_objdetect249.lib
opencv_ocl249.lib
opencv_photo249.lib
opencv_stitching249.lib
opencv_superres249.lib
opencv_ts249.lib
opencv_video249.lib opencv_videostab249.lib |
opencv_calib3d249d.lib
opencv_contrib249d.lib
opencv_core249d.lib
opencv_features2d249d.lib
opencv_flann249d.lib
opencv_gpu249d.lib
opencv_highgui249d.lib
opencv_imgproc249d.lib
opencv_legacy249d.lib
opencv_ml249d.lib
opencv_nonfree249d.lib
opencv_objdetect249d.lib
opencv_ocl249d.lib
opencv_photo249d.lib
opencv_stitching249d.lib
opencv_superres249d.lib
opencv_ts249d.lib
opencv_video249d.lib opencv_videostab249d.lib |
소스코드
#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <iostream>using namespace cv;using namespace std;int _tmain(int argc, _TCHAR* argv[])#if 1{
// opencv 1 styleCvCapture* capture = 0;Mat frame, frameCopy, image;capture = cvCaptureFromCAM( 0 ); //0=default, -1=any camera, 1..99=your cameraif(!capture) cout << "No camera detected" << endl;cvNamedWindow( "result", 1 );if( capture ){cout << "In capture ..." << endl;for(;;){IplImage* iplImg = cvQueryFrame( capture );frame = iplImg;if( frame.empty() )break;if( iplImg->origin == IPL_ORIGIN_TL )frame.copyTo( frameCopy );elseflip( frame, frameCopy, 0 );cvShowImage( "result", iplImg );if( waitKey( 10 ) >= 0 )cvReleaseCapture( &capture );}waitKey(0);cvDestroyWindow("result");return 0;}return 0;}#else{
// opencv 2 styleVideoCapture cap(0);if(!cap.isOpened()){cout << "No camera detected" << endl;return -1;}else{cout << "In capture ..." << endl;}namedWindow( "Display window", WINDOW_AUTOSIZE );for(;;){Mat frame;if(!cap.read(frame)) break;imshow("Display window", frame);if(waitKey(30) >= 0) break;}return 0;}#endif
이제 테스트파일인가 싶어 실행해 보고자 한다.
VS에서 tmain이 있는 곳을 찾아서 복붙!
그리고 [빌드] - [솔루션빌드] 하면
" #include "StdAfx.h"'을(를) 소스에 추가하시겠습니까? "라고 말함.
=> 해결 가장 윗줄에 #include "stdafx.h" 라고 적어준다.
그리고 [빌드] - [솔루션빌드] 하면
" x64' 모듈 컴퓨터 종류가 'X86' 대상 컴퓨터 종류와 충돌합니다. " 라고 말함
http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=50&MAEULNo=20&no=779979&ref=779979
http://www.isfull.com/bbs/board.php?bo_table=tb01&wr_id=1413
찾아서 따라하면 될 것 같은데 안된다....일단 보류
'차근차근 > OpenCV' 카테고리의 다른 글
Windows7 에서 minGW 설치하기 (0) | 2014.07.30 |
---|---|
openCV한글매뉴얼 (0) | 2014.07.30 |
openCV 입문자입니다..도움을 좀 받고 싶습니다. (0) | 2014.07.30 |
이클립스(케플러) + openCV2.4.9 +cmake + minGW + windows8 (0) | 2014.07.30 |
VS2010 + openCV2.4.9 "이거 따라해서 성공" (0) | 2014.07.30 |