ubuntu virtual machine under VMware "Qt5-Opencv3.4.9" installed

As long as the road will continue to extend our efforts will be installed to stop wood large full part

Piecemeal spent a few days at last count put a few stuff downloaded and installed, and sigh. Write about all sorts of things encountered when installed, if the benefit could not be better.


I repeat:
this is my summary of the various errors that occur when installed, to avoid the pit measures taken after written. If you encounter an error, then I did not come across, please recount.

A, Qt5 installation

Beacon's official website URL: https://download.qt.io/official_releases/qt/
according to their need to download the corresponding version, I have here the choice is
qt-opensource-linux-x64-5.12.3.run

Good After downloading terminal to execute the code

sudo apt-get update
cd DownLoads  #“DownLoads”是下载了qt的文件夹
chmod +x ./qt-opensource-linux-x64-5.9.1.run 
sudo ./qt-opensource-linux-x64-5.9.1.run 

Double-click the icon of the executable, in the graphical interface little point to complete a thing, there is a need to place the whole election when installing crap

After the installation also need to modify the configuration. In the terminal input the following code:
(vim gedit not necessarily also, as long as like a text editor)

sudo vim /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf

Documents are written Qt5 to open the bin directory and directory Qt5, for example:

/home/XXX/NUEDC/qt5/5.12.3/gcc_64/bin
/home/XXX/NUEDC/qt5  

To avoid misunderstanding declaration XXX is the name of the user

Save and exit the text editor, back to the terminal, enter the following command:

sudo apt-get install libgl1-mesa-dev

Qt5 installation is complete

Second, the installation and compiling OpenCV3.2.0 (including opencv_contrib)

1. Install opencv library dependencies (?

Since that rely on redundant listed here, I did not get to know what works in the end, we found some commands from the many blog together after the final step can finally begin
enter the following command in the terminal:

sudo apt-get install libgl1-mesa-dev
sudo apt-get -y install build-essential cmake pkg-config
sudo apt-get -y install libjpeg62-dev
sudo apt-get -y install libtiff4-dev libjasper-dev
sudo apt-get -y install libtiff4-dev
sudo apt-get -y install libtiff5-dev
sudo apt-get -y install libtiff5-dev libjasper-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install git libgtk2.0-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
sudo apt-get -y install libopencv-dev build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
sudo apt-get -y install libopencv-dev build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip  --fix-missing
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt install libavresample

Then install CMake executing the command in the terminal:

sudo apt-get install cmake

2. Download Opencv and Opencv-contrib

GFW have to say in this respect too block things, the network does not work directly download area basically impossible, we all recount it here.

The version number two files must be the same. (I choose here is 3.4.9)

After the download is two folders, put that into another contrib inside (just in case say about the meaning /opencv3.4.9/opencv_contrib-3.4.9 such relative relationship)

3. Compile (the highlight of error)

Executing the command in the terminal:

sudo apt install cmake-qt-gui
sudo apt-get install ccache

Open end (right + e, cd here meaning a) at opencv main folder, execute the following commands:

mkdir release  #我这里命名是release,有的博客是用的build,应该都没问题
cd release
cmake-gui

On the pop-up panel to graphical operation:

1)

"Where is the source code"
fill in opencv home folder path, opencv position to fill, such as "home / XXX / opencv3.4.9"

2)

"Where to build the binaries"
fill in the contrib folder path, such as "home / XXX / opencv3.4.9 / opencv_contrib -3.4.9"

3)

Search free in the pop section where tick

4)

Search contrib may not have columns may jump out
if not, click the Entry next to the search bar of the Add
Type changed Path
the Name fill in "OPENCV_EXTRA_MODULES_PATH"
Value Fill path "modules" folder contrib folder, such as "home / XXX / opencv3 .4.9 / opencv_contrib-3.4.9 / modules "

5)

Search qt
to WITH_QT hook marked
the value back Qt5_DIR changed cmake folder under the path Qt5 folder, such as "home / xxx / qt5 / 5.12.3 / gcc_64 / lib / cmake / Qt5"

6)

Click on the lower left corner of Configure, then Generate.


If all goes well there should be that only in a small box below the black, not red. But there high probability encounter problems beginning ippicv file download failed.
After trying various methods ultimately a way to take effect, here I am finally adopted guiding approach csdn blog


Here are the steps to compile a step from the beginning, I summarize the various errors that occur when installed, to avoid the pit measures taken after written. red configure error also appeared (such as just zdy just ask), I is not met if this step, please recount.

Come to Oliver! ! !

7)

Enter the following command in the terminal to release folder cd's:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=On -D WITH_OPENGL=ON OPENCV_EXTRA_MODULES_PATH=/home/XXX/opencv3.4.9/opencv_contrib-3.4.9/modules/ ..

Which, CMAKE_INSTALL_PREFIX library file is the installation directory, it is recommended to use this, WITH_QT = On must be selected, OPENCV_EXTRA_MODULES_PATH = followed by your contrib store absolute path (relative path do not know if), the latter two must be added.

8)

Enter the following command in the terminal to release folder cd's:

sudo make -j8 

The last digital camera represents the actual number of threads and some, such as eight thread CPU write j8, x here is too small, then the compiler is too slow, too many words will crash, so be careful.


Here you may encounter strange error, I encountered the following error:
c ++: Internal Compiler error: Killed (Program cc1plus)

After the query is found due to insufficient memory. Some say that virtual memory solutions, too big on. But since this is a virtual machine that I was using the shutdown (like the 3.8GB) transferred to allocate memory in vmware resolved


Third, the mop-up test

Referring to this blog first 9-12 steps csdn blog
first input terminal following the command executed before Step 12:

export LD_LIBRARY_PATH=/home/XXX/qt5/5.12.3/gcc_64/lib/

four,

Hooray!

发布了11 篇原创文章 · 获赞 5 · 访问量 3344

Guess you like

Origin blog.csdn.net/qq_24855707/article/details/104214714