This series of blogs is to record the problems and thoughts that the author encountered while studying the GAMES101 course.
- GAMES101: Course official website
- GAMES101: B station video
- GAMES101: Related file download (Baidu SkyDrive)
1. Environment construction
The following describes two ways to build the environment, one is to use the VirtualBox mentioned in the original video to build the environment with one click (but there are some problems in my environment that cannot be solved), and the other is to build the environment by myself (I use VMware software to build).
1. VirtualBox build
First download the ym_VirtualBox-6.1.4-136177-Win.exe file in the network disk to download and install the VirtualBox software, and then download the GAMES101_Ubuntu 18.04.2 (64bit).zip file in the network disk to extract the corresponding virtual machine image GAMES101_Ubuntu 18.04.2 ( 64bit).vdi , and then follow the pa0.pdf tutorial in Professor Yan's homework 0 to complete the creation of the virtual machine.
This section briefly talks about the problems I encountered:
- According to Professor Yan's tutorial, after creating a virtual machine, installing enhanced functions and making corresponding settings, the drag-and-drop function of files still cannot be used. Every time you drag into a folder, only an empty file will be created in the virtual machine. folder
I checked a lot of relevant information and still can't solve this problem. I don't know if it's a problem with the virtual machine settings or some files are missing during software installation. However, after testing, I found that I can drag in files, but I can't drag in a whole folder. So my final solution:
- After manually creating the folder yourself, manually drag in all the files
2. VMware build
This construction process refers to eine K1eine's blog , thanks again to eine K1eine for the tutorial! Record it for your convenience next time.
First, open the Baidu network disk mentioned at the beginning, enter the self-built environment folder, and download all three files in it:
- Virtual machine image file: ubuntu-20.04.1-desktop-amd64.iso
- VScode installation file: code_1.78.2-1683731010_amd64.deb
- OpenCV source file: opencv-4.7.0.tar.gz
Then use the virtual machine image to create a corresponding Ubuntu virtual machine. If you don’t know it here, you can refer to my previous blog VMware virtual machine download and installation , and modify the window10 image in step 4 to the Ubuntu image downloaded this time.
After the creation is complete, drag code_1.78.2-1683731010_amd64.deb and opencv-4.7.0.tar.gz into the Download folder of the virtual machine, and decompress the opencv-4.7.0.tar.gz file to the current directory.
Double-click the code_1.78.2-1683731010_amd64.deb file to install VScode into the virtual machine.
Then refer to eine K1eine 's blog tutorial, first configure the g++, cmake and eigen environment.
- g++ configuration
sudo apt-get -y install build-essential # 安装g++ g++ --version # 安装完成后检查版本
- cmake configuration
sudo apt-get -y install cmake #安装cmake cmake --version #照例检查版本
- eigen configuration
sudo apt-get -y install libeigen3-dev
After the three-piece set is configured, install the OpenCV dependency
sudo apt-get -y install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev
sudo apt-get -y install libcanberra-gtk-module
sudo apt-get -y install pkg-config
After the installation is complete, enter the directory Downloads/opencv-4.7.0 that has just been decompressed , right-click to open the terminal here, and output the following commands in sequence
sudo mkdir build
cd build
sudo cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_GENERATE_PKGCONFIG=ON -D CMAKE_INSTALL_PREFIX=/usr/local ..
#-j8 8指同时使用8个进程,速度快,你也可以根据自己的电脑情况,用-j2 或者-j16
sudo make -j8
sudo make install
Next configure environment variables
-
Add the library to the system path
sudo gedit /etc/ld.so.conf
Add in the last line of the file
include /usr/local/lib
, because the default opencv installation in the makefile is under this path
then updatesudo ldconfig
-
Configure bash, modify the bash.bashrc file
sudo gedit /etc/bash.bashrc
Add two lines at the end of the file
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH
As follows:
Save and exit, and then update the source
source /etc/bash.bashrc
At this point the relevant environment is configured
2. Homework 0 Answers
According to the above pa0.pdf written by Professor Yan, we can learn about the creation, assignment and operation of vectors/matrixes in the Eigen library. If you are not familiar with this, you must take a closer look, otherwise you will be confused when you look at the code later. force.
It can be seen from the lecture that a vector can be represented by (x, y, 0), and a point can be represented by (x, y, 1). For homework 0, we only need to create a point of (2, 1, 1) first, and Just write the corresponding rotation matrix according to the rotation operation on page 28 in Courseware 3: GAMES101_Lecture_03.pdf.
Right now:
// rotate
Eigen::Vector3f p(2.0f,1.0f,1.0f);
Eigen::Matrix3f rotate45;
rotate45 <<
sqrt(2)/2, -sqrt(2)/2, 1,
sqrt(2)/2, sqrt(2)/2, 2,
0, 0, 0;
cout << rotate45 * p << endl;
First create a new build folder in Assignment0 , and then enter this folder: According to the content in pa0.pdf , you can know that after opening the terminal in the build folder, you need to re-enter every time you compile
cmake ..
make
./Transformation
So create a new run0.sh script, which contains the above three commands, so that you only need to execute run0.sh for each execution , and open the terminal in the build folder
touch run0.sh
gedit run0.sh
and add to the script
#/bin/bash
cmake ..
make
./Transformation
Modify execution permissions after saving and exiting
chmod 777 run0.sh
After that, just run the run0.sh script directly every time
./run0.sh
If the final result is like this, it means that the operation is correct: