HighGUI is missing from OpenCV 3.0.0 JAR
Asked Answered
B

3

38

I was compiling OpenCV 3.0.0 with Java support. My script was:

mkdir /opt/opencv /opt/opencv/opencv-build
cd /opt/opencv
git clone https://github.com/Itseez/opencv.git 
cd /opt/opencv/opencv-build
export OPENCV_INSTALL_PATH=/opt/opencv
export FFMPEG_PATH=/opt/ffmpeg/ffmpeg_build/lib
export LD_LIBRARY_PATH=$OPENCV_INSTALL_PATH/lib:$FFMPEG_PATH:/opt/opencv/opencv/3rdparty/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/opt/ffmpeg/ffmpeg_build/lib/pkgconfig
cmake28 -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX="/opt/opencv" \
        -D OPENCV_EXTRA_C_FLAGS="-DHAVE_CAMV4L -DHAVE_CAMV4L2" \
        -D WITH_OPENCL=OFF -D BUILD_SHARED_LIBS=OFF ../opencv
make
make install

as told in http://docs.opencv.org/doc/tutorials/introduction/desktop_java/java_dev_intro.html with -D BUILD_SHARED_LIBS=OFF.

And when I wanted to test installation I found out that there is no Highgui class and no path for it. Here are my opencv-300.jar org.opencv folder contents:

calib3d
core
features2d
imgcodecs
imgproc
ml
objdetect
photo
utils
video
videoio

Have I missed something during installation?

Belated answered 31/7, 2014 at 13:2 Comment(3)
OpenCV 3.0.0 is not yet a stable version, it is probably something because it is still in dev modeGabfest
highgui was split up into videoio,imcdodecs and highgui. it's not included in the jar, since there is no gui functionality for javaSc
@Sc yes, you are right.Belated
S
65

Short Answer : There is no more HighGUI module in Java for 3.0 anymore.

Long One : The functionality in HighGUI has been split into two additional modules:

  1. videoio (VideoCapture, VideoWriter).
  2. imgcodecs (imread/imwrite and friends).

Since there's no GUI functionality exposed to Java, there is no need to have a HighGUI module in Java anymore.

Sc answered 19/9, 2014 at 22:12 Comment(1)
OLD CODE: Highgui.imencode(".bmp", frame, mem); NEW CODE: Imgcodecs.imencode(".bmp", frame, mem);Breadstuff
M
73

Migrating from OpenCV 2.x to 3.0.0 (Java)

Highgui.imread(fileName, Highgui.CV_LOAD_IMAGE_GRAYSCALE)
Highgui.imread(fileName)

become resp:

Imgcodecs.imread(fileName, Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE)
Imgcodecs.imread(fileName)

Also, drawing functions such as:

Core.circle(..), Core.line(..), etc..

Have been moved to:

Imgproc.circle(..), Imgproc.line(..)

Note Moments, HuMoments missing in 3.0.0. Will be fixed in 3.1 See bug

Mikkanen answered 27/9, 2015 at 15:47 Comment(2)
Nice, thanks for adding additional changes required.Blueweed
Thank you very much, you saved me a lot of trouble !Kwei
S
65

Short Answer : There is no more HighGUI module in Java for 3.0 anymore.

Long One : The functionality in HighGUI has been split into two additional modules:

  1. videoio (VideoCapture, VideoWriter).
  2. imgcodecs (imread/imwrite and friends).

Since there's no GUI functionality exposed to Java, there is no need to have a HighGUI module in Java anymore.

Sc answered 19/9, 2014 at 22:12 Comment(1)
OLD CODE: Highgui.imencode(".bmp", frame, mem); NEW CODE: Imgcodecs.imencode(".bmp", frame, mem);Breadstuff
B
2

Yesterday I found at the end of introduction http://docs.opencv.org/2.4/doc/tutorials/introduction/clojure_dev_intro/clojure_dev_intro.html answer for my question:

The OpenCV Java API does not wrap the highgui module functionalities depending on Qt (e.g. namedWindow and imshow. If you want to create windows and show images into them while interacting with OpenCV from the REPL, at the moment you’re left at your own. You could use Java Swing to fill the gap.

Belated answered 1/8, 2014 at 10:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.