[筆記] 安裝opencv java以及eclipse 相關設定 (linux)
作業系統:ubuntu 14.04
我的Java版本
opencv 從 0 開始安裝:
先看這篇:
http://docs.opencv.org/3.0-beta/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
記得電腦要先有安裝
cmake
apache ant
執行指令1:
執行指令2:
執行指令3:
以上是為了準備要安裝opencv的環境
做完以後,接著去下載opencv的檔案
我是到這裡載 opencv 3.0.0 for linux
http://opencv.org/downloads.html
載完後先解壓縮到想要放的地方

會看到這個資料夾出現
cd 進去 先 mkdir 一個資料夾,我的命名為 release:

可以參考網站上的教學指令
進入 release 資料夾裡面執行完 cmake 那行指令之後
可以看到 release 資料夾裡面出現了好多好多東西:

檢查一下 bin 資料夾裡面有沒有 jar 檔

有看到 opencv-300.jar ,如果沒有的話可能是 cmake 的指令有下錯導致
回上一層資料夾,順便看一下 lib 資料夾的內容

裡面有 .so 檔

確認完畢後
打開 eclipse
選項Window -> preference -> 選 Build Path -> User Libraries


點選 New... 按鈕
輸入一個名稱 我叫它 opencv-300 ,按下OK完成後

可以看到出現了一個 opencv-300

點選 opencv-300 後,並且選 Add External JARs... 這個按鈕
並且去找剛剛 opencv-300.jar 的資料夾,
我的是放在 Documents/opencv-3.0.0/release/bin/

我的Java版本
opencv 從 0 開始安裝:
先看這篇:
http://docs.opencv.org/3.0-beta/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
記得電腦要先有安裝
cmake
apache ant
執行指令1:
執行指令2:
執行指令3:
以上是為了準備要安裝opencv的環境
做完以後,接著去下載opencv的檔案
我是到這裡載 opencv 3.0.0 for linux
http://opencv.org/downloads.html
載完後先解壓縮到想要放的地方

會看到這個資料夾出現
cd 進去 先 mkdir 一個資料夾,我的命名為 release:

可以參考網站上的教學指令
進入 release 資料夾裡面執行完 cmake 那行指令之後
可以看到 release 資料夾裡面出現了好多好多東西:

檢查一下 bin 資料夾裡面有沒有 jar 檔

有看到 opencv-300.jar ,如果沒有的話可能是 cmake 的指令有下錯導致
回上一層資料夾,順便看一下 lib 資料夾的內容

裡面有 .so 檔

確認完畢後
打開 eclipse
選項Window -> preference -> 選 Build Path -> User Libraries



點選 New... 按鈕
輸入一個名稱 我叫它 opencv-300 ,按下OK完成後

可以看到出現了一個 opencv-300

點選 opencv-300 後,並且選 Add External JARs... 這個按鈕
並且去找剛剛 opencv-300.jar 的資料夾,
我的是放在 Documents/opencv-3.0.0/release/bin/

這步驟設定完成後 可以看到目前展開的資料長這樣

以上的設定以及後續的測試應用可以參考這篇:
http://opencv-java-tutorials.readthedocs.org/en/latest/01-installing-opencv-for-java.html#install-opencv-3-0-under-linux-or-mac
如何使用?
先在 eclipse 建一個 Java Project 我取名為 CVTEST

選取Project資料夾,按右鍵設定 Build Path -> Configure Build Path...

進去以後 Java Build Path -> Add Library...

選 User Library

Next>

勾選 opencv-300 即完成Project的設定!!
寫一個主程式來測試!
這裏有詳細的code跟說明:
http://opencv-java-tutorials.readthedocs.org/en/latest/02-first-java-application-with-opencv.html
code 我就不贅述了
附上美美的結果圖

接著,點選 Native library location -> 按下右邊的 Edit...
這裏要找的路徑很關鍵,網站上沒有講得很清楚,
要去找到剛剛放 .so 檔案的 lib資料夾才可以
我自己是放在 Documents/opencv-3.0.0/release/lib/

以上的設定以及後續的測試應用可以參考這篇:
http://opencv-java-tutorials.readthedocs.org/en/latest/01-installing-opencv-for-java.html#install-opencv-3-0-under-linux-or-mac
如何使用?
先在 eclipse 建一個 Java Project 我取名為 CVTEST

選取Project資料夾,按右鍵設定 Build Path -> Configure Build Path...

進去以後 Java Build Path -> Add Library...

選 User Library

Next>

勾選 opencv-300 即完成Project的設定!!
寫一個主程式來測試!
這裏有詳細的code跟說明:
http://opencv-java-tutorials.readthedocs.org/en/latest/02-first-java-application-with-opencv.html
code 我就不贅述了
附上美美的結果圖

留言
張貼留言