FreeBSDでOpenCVが導入できない
FreeBSDでOpenCVを用いたサンプルをコンパイルしたいのですが、パッケージが存在しないとエラーが出てしまいます。FreeBSD上でOpenCVをインストールした結果は以下のとおりです。
# make install
===> Installing for opencv-3.4.1_4
===> Checking if opencv already installed
===> Registering installation for opencv-3.4.1_4
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_annotation - required shared library libopencv_imgproc.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_annotation - required shared library libopencv_core.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_createsamples - required shared library libopencv_imgproc.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_createsamples - required shared library libopencv_core.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_interactive-calibration - required shared library libopencv_imgproc.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_interactive-calibration - required shared library libopencv_core.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_traincascade - required shared library libopencv_imgproc.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_traincascade - required shared library libopencv_core.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_version - required shared library libopencv_imgproc.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_version - required shared library libopencv_core.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_visualisation - required shared library libopencv_imgproc.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_visualisation - required shared library libopencv_core.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_waldboost_detector - required shared library libopencv_imgproc.so.3.4 not found
(opencv-3.4.1_4) /usr/ports/graphics/opencv/work/stage//usr/local/bin/opencv_waldboost_detector - required shared library libopencv_core.so.3.4 not found
Installing opencv-3.4.1_4...
===> NOTICE:
The opencv port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:
https://bugs.freebsd.org/bugzilla
More information about port maintainership is available at:
https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port
ソースコード
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
public class Hello{
public static void main(String[] args) {
//System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
String input = "/home/○○/lena.jpg";
String output = "/home/○○/opencvsample/result.jpg";
//Mat matrixSrc = new Mat();
//Mat matrixDst = new Mat();
// 入力画像の読み込み
//matrixSrc = Imgcodecs.imread(input);
// カラー画像をグレー画像に変換
//Imgproc.cvtColor(matrixSrc, matrixDst, Imgproc.COLOR_BGR2GRAY);
//Imgcodecs.imwrite(output, matrixDst);
System.out.println("Done!");
}
}
どうすればOpenCVを用いたソースがコンパイルできるか分かる人回答お願いします。
エラーメッセージ
javac -classpath /usr/local/share/OpenCV/java/opencv-341.jar Hello.java
java -cp /usr/local/share/OpenCV/java/opencv-341.jar Hello
エラー: メイン・クラスHelloが見つからなかったかロードできませんでした
java -cp /usr/local/share/OpenCV/java/opencv-341.jar:/home/○○/opencvsample Hello
Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java341 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at Hello.main(Hello.java:9)