Starting from:

$25

ROS -    Robot Programming -Simulation - Laboratory exercise 7 - Solved

Building projects on Linux using CMake

Name:

Preparation and helpful instructions
JMBAG:
•   Review the lecture slides about compiling and linking C++ code on linux.

•   For the first task, you will need to install the Boost library. On Ubuntu 20.04, we recommend installing version 1.71 by invoking the command sudo apt install libboost1.71-all-dev, but any other version should suffice.

•   For the second task, you will need to figure out CMake commands find package and include  directories.

Assignments
 

Task 1: Linear algebra using the Boost library
In this assignment you will write and build a program that carries out simple linear algebra operations using the Basic Linear Algebra Library (uBLAS) which is a part of Boost. Boost is a set of widely used free peer-reviewed portable C++ source libraries that can help you speed up development by reducing the reinvention-of-the-wheel. You can access the uBLAS documentation here.

Do not forget to import relevant uBLAS header files in your source file(s). Write your code in a C++ file named firstname_lastname.cpp. Write the CMakeLists.txt file, name the project and the executable file firstname_lastname. Build the program with CMake.

If cmake is not able to find Boost on its own, try using the SET command to instruct it where Boost is. Check the example on the following link.

a)    Inside the main() function using uBLAS define two matrices m1 and m2 with dimensions 5×5 and a vector v with dimension 5. Fill the matrix m1 such that each row contains the first 5 digits of your JMBAG number. Generate matrix m2 by summing m1 with the identity matrix of the same size. Fill the vector v with the last 5 digits of your JMBAG number.

b)    Multiply the matrix m2 and the vector v and write the result on the standard output. Paste the output in the following text box.

c)     Multiply the vector v with its transpose and write the result on the standard output. Paste the output in the following text box.

d)    Calculate the sum of matrices m1 and m2 and write it on the standard output. Paste the output in the following text box.

e)    Calculate the inverse of the matrix m2 and write it on the standard output. Paste the output in the following text box.                                                                                                     
 

Task 2: Face detection using the OpenCV library
In this assignment you will build a face detector using OpenCV, which is an open source computer vision and machine learning software library. Unpack faceDetection.zip which contains the source code and parameters files for this task. Your job is to write the CMakeLists.txt and compile the program with CMake.

a)    Check if you have the objdetect, highgui and imgproc OpenCV libraries installed (required for the program). They should have been installed within your ROS installation. What is the location of the folder where these shared libraries are placed?

b)    Copy any .jpg image with a human face in the same folder as your objecDetection.cpp source file. Name the image face.jpg.

c)     Write the CMakeLists.txt file from scratch, build the program with CMake and run the executable file. If a face was detected program will create face_detection.jpg image with the detected face and eyes. In the following text field write every command that you used in the process.

More products