2016年4月25日 星期一

ModeR_Week10_GLUT教學_圖片置入_"複習"

Week10

本次以複習為主軸

Work01-開啟地球旋轉圖

第一步:先下載openCV 2.1版本

第二步:安裝openCV,在Install Options選擇 Add OpenCV to the system PATH

第三步:將myearth and freeglut 解壓縮於桌面後,
將C:\Users\USER\Desktop\freeglut\bin中的freeglut.dll 放入myearth的資料夾中



第四步:找尋地球圖片(注意:請找展開圖,不要找球面圖



最終步:開啟myearth.exe,就可以看到地球的旋轉圖


Work02-從程式中開啟地球旋轉圖


第一步:開啟myEarth.cbp



第二步:於左方專案中,按右鍵開啟Build Option




第三步:設定找尋openCV與freeglut的位置及檔案
注意:請選擇絕對位置,不要選相對位置

3-1
Linker settings中加入

cv210
cxcore210
highgui210

3-2
在Search directories的Compiler中加入

openCV中include資料夾的位置
freeglut中include資料夾的位置

3-3
在Search directories的Linker中加入

openCV中lib資料夾的位置
freeglut中lib資料夾的位置


第四步:按Build建置


接下來會有兩種啟動方式

方式一:將位於myEarth資料夾中bin/Debug/myEarth.exe拉出到與myEarth.cbp相同平面的資料夾



最後執行myEarth.exe檔案(注意:如果沒有image.jpg位於相同資料夾中將無法執行



方式二:

先將image.jpg放置於freeglut/bin資料夾中


放置完後於專案中執行





Work03-從Console application中開啟地球旋轉圖


第一步:開啟新專案Console application



第二步:選擇C++


第三步:將新專案中位於main,cpp的程式碼刪除,將原本位於myEarth的程式碼複製到新專案的main,cpp中

這時,如果直接執行的話,會因為找不到freeglut與openCV的檔案,而無法執行
因此接下來要將檔案位置與名稱告訴他


第四步:於左方專案中,按右鍵開啟Build Option
設定找尋openCV與freeglut的位置及檔案

注意:請選擇絕對位置,不要選相對位置



3-1
Linker settings中加入

cv210
cxcore210
highgui210
freeglut
glu32
gdi32
winmm
opengl32

上述7個加入於Link libraries




3-2
在Search directories的Compiler中加入

openCV中include資料夾的位置
freeglut中include資料夾的位置


3-3
在Search directories的Linker中加入

openCV中lib資料夾的位置
freeglut中lib資料夾的位置





第四步:新增檔案於指定位置
可以看到圖中說明找不到freeglut
所以將freeglut/bin/freeglut.dll複製到下方所提供的索引位置



最終步:將freeglut.dll放置到索引位置後再執行一次即可達成成果看到地球了



沒有留言:

張貼留言