diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..92d6badc --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,22 @@ +{ + "name": "Ubuntu 22.04 OpenCV - Dev Container", + "image": "ubuntu-jammy-opencv-dev", + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.shell.linux": "bash" + }, + "extensions": [ + "ms-vscode.cmake-tools", + "ms-vscode.cpptools" + ] + } + }, + "postStartCommand": "bash", + "remoteUser": "user", + "runArgs": [ + "-e", "DISPLAY=host.docker.internal:0.0", + "--rm", + "--name", "ubuntu-jammy-opencv-dev" + ] +} diff --git a/.gitignore b/.gitignore index a640a951..e691bd24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ **.DS_Store -**.vscode \ No newline at end of file +**.vscode +build/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..cab44395 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third-party/opencv4.10"] + path = third-party/opencv4.10 + url = https://github.com/opencv/opencv.git diff --git a/01-playground/CMakeLists.txt b/01-playground/CMakeLists.txt new file mode 100644 index 00000000..6e7ce0b9 --- /dev/null +++ b/01-playground/CMakeLists.txt @@ -0,0 +1,17 @@ +# 01-playground/CMakeLists.txt +cmake_minimum_required(VERSION 3.15) +project(MyApp) + +# Set C++ standard +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() + +# Add your app +add_executable(MyApp src/main.cpp) + +# Link against OpenCV shared libraries built in Release +target_link_libraries(MyApp ${OpenCV_LIBS}) diff --git a/01-playground/src/main.cpp b/01-playground/src/main.cpp new file mode 100644 index 00000000..cfe2e4ea --- /dev/null +++ b/01-playground/src/main.cpp @@ -0,0 +1,14 @@ +// 01-playground/src/main.cpp +#include +#include + +int main() { + std::cout << "OpenCV Version: " << CV_VERSION << std::endl; + + cv::Mat image = cv::Mat::zeros(300, 300, CV_8UC3); + cv::putText(image, "Hello, OpenCV!", cv::Point(50, 150), cv::FONT_HERSHEY_SIMPLEX, 1.0, cv::Scalar(0, 255, 0), 2); + + cv::imshow("OpenCV Window", image); + cv::waitKey(0); + return 0; +} diff --git a/02-opencv-library/CMakeLists.txt b/02-opencv-library/CMakeLists.txt new file mode 100644 index 00000000..7d75a811 --- /dev/null +++ b/02-opencv-library/CMakeLists.txt @@ -0,0 +1,33 @@ +# 02-opencv-library/CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) + +project(sfnd-camera LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CXX_FLAGS "-Wall") +set(CMAKE_CXX_FLAGS "${CXX_FLAGS}") + +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() + +# Include OpenCV headers +include_directories(${OpenCV_INCLUDE_DIRS}) + +# Add binaries for source files +add_executable(create_matrix src/create_matrix.cpp) +target_link_libraries(create_matrix PRIVATE ${OpenCV_LIBS}) + +add_executable(change_pixels src/change_pixels.cpp) +target_link_libraries(change_pixels PRIVATE ${OpenCV_LIBS}) + +add_executable(load_image_1 src/load_image_1.cpp) +target_link_libraries(load_image_1 PRIVATE ${OpenCV_LIBS}) + +add_executable(load_image_2 src/load_image_2.cpp) +target_link_libraries(load_image_2 PRIVATE ${OpenCV_LIBS}) + +add_executable(load_image_3 src/load_image_3.cpp) +target_link_libraries(load_image_3 PRIVATE ${OpenCV_LIBS}) diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0005.jpg b/02-opencv-library/images/img0005.jpg similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0005.jpg rename to 02-opencv-library/images/img0005.jpg diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0005.png b/02-opencv-library/images/img0005.png similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0005.png rename to 02-opencv-library/images/img0005.png diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0006.jpg b/02-opencv-library/images/img0006.jpg similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0006.jpg rename to 02-opencv-library/images/img0006.jpg diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0006.png b/02-opencv-library/images/img0006.png similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0006.png rename to 02-opencv-library/images/img0006.png diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0007.jpg b/02-opencv-library/images/img0007.jpg similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0007.jpg rename to 02-opencv-library/images/img0007.jpg diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0007.png b/02-opencv-library/images/img0007.png similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0007.png rename to 02-opencv-library/images/img0007.png diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0008.jpg b/02-opencv-library/images/img0008.jpg similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0008.jpg rename to 02-opencv-library/images/img0008.jpg diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0008.png b/02-opencv-library/images/img0008.png similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0008.png rename to 02-opencv-library/images/img0008.png diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0009.jpg b/02-opencv-library/images/img0009.jpg similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0009.jpg rename to 02-opencv-library/images/img0009.jpg diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0009.png b/02-opencv-library/images/img0009.png similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img0009.png rename to 02-opencv-library/images/img0009.png diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img1.png b/02-opencv-library/images/img1.png similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img1.png rename to 02-opencv-library/images/img1.png diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img1gray.png b/02-opencv-library/images/img1gray.png similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img1gray.png rename to 02-opencv-library/images/img1gray.png diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img2gray.png b/02-opencv-library/images/img2gray.png similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/images/img2gray.png rename to 02-opencv-library/images/img2gray.png diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/solutions/change_pixels.cpp b/02-opencv-library/solutions/change_pixels.cpp similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/solutions/change_pixels.cpp rename to 02-opencv-library/solutions/change_pixels.cpp diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/solutions/create_matrix.cpp b/02-opencv-library/solutions/create_matrix.cpp similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/solutions/create_matrix.cpp rename to 02-opencv-library/solutions/create_matrix.cpp diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/solutions/load_image_3.cpp b/02-opencv-library/solutions/load_image_3.cpp similarity index 100% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/solutions/load_image_3.cpp rename to 02-opencv-library/solutions/load_image_3.cpp diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/change_pixels.cpp b/02-opencv-library/src/change_pixels.cpp similarity index 84% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/change_pixels.cpp rename to 02-opencv-library/src/change_pixels.cpp index 470d0450..5bc7da57 100644 --- a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/change_pixels.cpp +++ b/02-opencv-library/src/change_pixels.cpp @@ -16,7 +16,11 @@ void changePixels() for (int r = 230; r < 250; r++) { // STUDENT TASK : loop over all columns and set matrix elements to 255 - + for (int col = 0; col < m1_8u.cols; col++) + { + m1_8u.at(r, col) = 255; + } + } // show result diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/create_matrix.cpp b/02-opencv-library/src/create_matrix.cpp similarity index 68% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/create_matrix.cpp rename to 02-opencv-library/src/create_matrix.cpp index 4e4a1256..48cf28c1 100644 --- a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/create_matrix.cpp +++ b/02-opencv-library/src/create_matrix.cpp @@ -13,10 +13,12 @@ void createMatrix1() m1_8u.create(nrows, ncols, CV_8UC1); // two-channel matrix with 8bit unsigned elements m1_8u.setTo(cv::Scalar(255)); // white - // STUDENT TASK : + // STUDENT TASK: // Create a variable of type cv::Mat* named m3_8u which has three channels with a // depth of 8bit per channel. Then, set the first channel to 255 and display the result. - + cv::Mat m3_u8; + m3_u8.create(nrows, ncols, CV_8UC3); // three-channel matrix with 8bit unsigned elements + m3_u8.setTo(cv::Scalar(255, 0, 0)); // blue // show result string windowName = "First steps in OpenCV (m1_8u)"; @@ -24,9 +26,12 @@ void createMatrix1() cv::imshow(windowName, m1_8u); cv::waitKey(0); // wait for keyboard input before continuing - // STUDENT TASK : + // STUDENT TASK: // Display the results from the STUDENT TASK above - + windowName = "First steps in OpenCV (m3_8u)"; + cv::namedWindow(windowName, 1); // create window + cv::imshow(windowName, m3_u8); + cv::waitKey(0); // wait for keyboard input before continuing } diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/load_image_1.cpp b/02-opencv-library/src/load_image_1.cpp similarity index 55% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/load_image_1.cpp rename to 02-opencv-library/src/load_image_1.cpp index 98f1d192..e5aef9f6 100644 --- a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/load_image_1.cpp +++ b/02-opencv-library/src/load_image_1.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -8,9 +9,16 @@ using namespace std; void loadImage1() { + // current_path() returns a std::filesystem::path + std::filesystem::path cwd = std::filesystem::current_path(); + + std::cout << "Current working directory: " << cwd << std::endl; + // load image from file cv::Mat img; - img = cv::imread("../images/img1.png"); + // This is if you run from the root dir like so: + // ./build/02-opencv-library/Debug/load_image_1.exe + img = cv::imread("02-opencv-library/images/img1.png"); // show result string windowName = "First steps in OpenCV"; diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/load_image_2.cpp b/02-opencv-library/src/load_image_2.cpp similarity index 89% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/load_image_2.cpp rename to 02-opencv-library/src/load_image_2.cpp index 8a19cfea..39a40994 100644 --- a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/load_image_2.cpp +++ b/02-opencv-library/src/load_image_2.cpp @@ -15,7 +15,7 @@ void loadImage2() // create file name ostringstream imgNumber; // #include imgNumber << setfill('0') << setw(4) << i; // #include - string filename = "../images/img" + imgNumber.str() + ".png"; + string filename = "02-opencv-library/images/img" + imgNumber.str() + ".png"; // load and display image cv::Mat img; diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/load_image_3.cpp b/02-opencv-library/src/load_image_3.cpp similarity index 86% rename from Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/load_image_3.cpp rename to 02-opencv-library/src/load_image_3.cpp index c5fcb914..5a7f486d 100644 --- a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/src/load_image_3.cpp +++ b/02-opencv-library/src/load_image_3.cpp @@ -16,7 +16,7 @@ void loadImage3() // create file name ostringstream imgNumber; // #include imgNumber << setfill('0') << setw(4) << i; // #include - string filename = "../images/img" + imgNumber.str() + ".jpg"; + string filename = "02-opencv-library/images/img" + imgNumber.str() + ".jpg"; // load image and store it into a vector cv::Mat img; @@ -29,8 +29,11 @@ void loadImage3() cv::namedWindow(windowName, 1); // create window for (auto it = imgList.begin(); it != imgList.end(); ++it) { - // STUDENT TASK : Prevent image 7 from being displayed + if (it == imgList.begin() + 2) + { + continue; + } // display image cv::imshow(windowName, *it); diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/CMakeLists.txt b/03-collision-detection-system/ttc-camera/CMakeLists.txt similarity index 52% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/CMakeLists.txt rename to 03-collision-detection-system/ttc-camera/CMakeLists.txt index d9f526e2..ca5f0649 100644 --- a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/CMakeLists.txt +++ b/03-collision-detection-system/ttc-camera/CMakeLists.txt @@ -1,14 +1,19 @@ -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +# 03-collision-detection-system/ttc-camera/CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -add_definitions(-std=c++11) +project(sfnd-camera LANGUAGES CXX) -set(CXX_FLAGS "-Wall" "-pedantic") -set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -project(camera_fusion) +set(CXX_FLAGS "-Wall") +set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") -find_package(OpenCV 4.1 REQUIRED) +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() +# Include OpenCV headers include_directories(${OpenCV_INCLUDE_DIRS}) link_directories(${OpenCV_LIBRARY_DIRS}) add_definitions(${OpenCV_DEFINITIONS}) diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptMatches_AKAZE.dat b/03-collision-detection-system/ttc-camera/dat/C23A5_KptMatches_AKAZE.dat similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptMatches_AKAZE.dat rename to 03-collision-detection-system/ttc-camera/dat/C23A5_KptMatches_AKAZE.dat diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptMatches_SHI-BRISK.dat b/03-collision-detection-system/ttc-camera/dat/C23A5_KptMatches_SHI-BRISK.dat similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptMatches_SHI-BRISK.dat rename to 03-collision-detection-system/ttc-camera/dat/C23A5_KptMatches_SHI-BRISK.dat diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptsRef_AKAZE.dat b/03-collision-detection-system/ttc-camera/dat/C23A5_KptsRef_AKAZE.dat similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptsRef_AKAZE.dat rename to 03-collision-detection-system/ttc-camera/dat/C23A5_KptsRef_AKAZE.dat diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptsRef_SHI-BRISK.dat b/03-collision-detection-system/ttc-camera/dat/C23A5_KptsRef_SHI-BRISK.dat similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptsRef_SHI-BRISK.dat rename to 03-collision-detection-system/ttc-camera/dat/C23A5_KptsRef_SHI-BRISK.dat diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptsSource_AKAZE.dat b/03-collision-detection-system/ttc-camera/dat/C23A5_KptsSource_AKAZE.dat similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptsSource_AKAZE.dat rename to 03-collision-detection-system/ttc-camera/dat/C23A5_KptsSource_AKAZE.dat diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptsSource_SHI-BRISK.dat b/03-collision-detection-system/ttc-camera/dat/C23A5_KptsSource_SHI-BRISK.dat similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/dat/C23A5_KptsSource_SHI-BRISK.dat rename to 03-collision-detection-system/ttc-camera/dat/C23A5_KptsSource_SHI-BRISK.dat diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/solution/compute_ttc_camera.cpp b/03-collision-detection-system/ttc-camera/solution/compute_ttc_camera.cpp similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/solution/compute_ttc_camera.cpp rename to 03-collision-detection-system/ttc-camera/solution/compute_ttc_camera.cpp diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/src/compute_ttc_camera.cpp b/03-collision-detection-system/ttc-camera/src/compute_ttc_camera.cpp similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/src/compute_ttc_camera.cpp rename to 03-collision-detection-system/ttc-camera/src/compute_ttc_camera.cpp diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/src/dataStructures.h b/03-collision-detection-system/ttc-camera/src/dataStructures.h similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/src/dataStructures.h rename to 03-collision-detection-system/ttc-camera/src/dataStructures.h diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/src/structIO.cpp b/03-collision-detection-system/ttc-camera/src/structIO.cpp similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/src/structIO.cpp rename to 03-collision-detection-system/ttc-camera/src/structIO.cpp diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/src/structIO.hpp b/03-collision-detection-system/ttc-camera/src/structIO.hpp similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/TTC_camera/src/structIO.hpp rename to 03-collision-detection-system/ttc-camera/src/structIO.hpp diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/CMakeLists.txt b/03-collision-detection-system/ttc-lidar/CMakeLists.txt similarity index 52% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/CMakeLists.txt rename to 03-collision-detection-system/ttc-lidar/CMakeLists.txt index 94f4ae0b..5470feeb 100644 --- a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/CMakeLists.txt +++ b/03-collision-detection-system/ttc-lidar/CMakeLists.txt @@ -1,14 +1,19 @@ -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +# 03-collision-detection-system/ttc-lidar/CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -add_definitions(-std=c++11) +project(sfnd-camera LANGUAGES CXX) -set(CXX_FLAGS "-Wall" "-pedantic") -set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -project(camera_fusion) +set(CXX_FLAGS "-Wall") +set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") -find_package(OpenCV 4.1 REQUIRED) +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() +# Include OpenCV headers include_directories(${OpenCV_INCLUDE_DIRS}) link_directories(${OpenCV_LIBRARY_DIRS}) add_definitions(${OpenCV_DEFINITIONS}) diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/dat/C22A5_currLidarPts.dat b/03-collision-detection-system/ttc-lidar/dat/C22A5_currLidarPts.dat similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/dat/C22A5_currLidarPts.dat rename to 03-collision-detection-system/ttc-lidar/dat/C22A5_currLidarPts.dat diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/dat/C22A5_prevLidarPts.dat b/03-collision-detection-system/ttc-lidar/dat/C22A5_prevLidarPts.dat similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/dat/C22A5_prevLidarPts.dat rename to 03-collision-detection-system/ttc-lidar/dat/C22A5_prevLidarPts.dat diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/solution/compute_ttc_lidar.cpp b/03-collision-detection-system/ttc-lidar/solution/compute_ttc_lidar.cpp similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/solution/compute_ttc_lidar.cpp rename to 03-collision-detection-system/ttc-lidar/solution/compute_ttc_lidar.cpp diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/src/compute_ttc_lidar.cpp b/03-collision-detection-system/ttc-lidar/src/compute_ttc_lidar.cpp similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/src/compute_ttc_lidar.cpp rename to 03-collision-detection-system/ttc-lidar/src/compute_ttc_lidar.cpp diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/src/dataStructures.h b/03-collision-detection-system/ttc-lidar/src/dataStructures.h similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/src/dataStructures.h rename to 03-collision-detection-system/ttc-lidar/src/dataStructures.h diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/src/structIO.cpp b/03-collision-detection-system/ttc-lidar/src/structIO.cpp similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/src/structIO.cpp rename to 03-collision-detection-system/ttc-lidar/src/structIO.cpp diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/src/structIO.hpp b/03-collision-detection-system/ttc-lidar/src/structIO.hpp similarity index 100% rename from Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/TTC_lidar/src/structIO.hpp rename to 03-collision-detection-system/ttc-lidar/src/structIO.hpp diff --git a/04-tracking-image-features/cornerness_harris/CMakeLists.txt b/04-tracking-image-features/cornerness_harris/CMakeLists.txt new file mode 100644 index 00000000..65cc004f --- /dev/null +++ b/04-tracking-image-features/cornerness_harris/CMakeLists.txt @@ -0,0 +1,23 @@ +# 04-tracking-image-features/cornerness_harris/CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) + +project(sfnd-camera LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CXX_FLAGS "-Wall") +set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") + +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() + +# Include OpenCV headers +include_directories(${OpenCV_INCLUDE_DIRS}) +link_directories(${OpenCV_LIBRARY_DIRS}) +add_definitions(${OpenCV_DEFINITIONS}) + +# Executables for exercise +add_executable (cornerness_harris src/cornerness_harris.cpp) +target_link_libraries (cornerness_harris ${OpenCV_LIBRARIES}) diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0005.jpg b/04-tracking-image-features/cornerness_harris/images/img0005.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0005.jpg rename to 04-tracking-image-features/cornerness_harris/images/img0005.jpg diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0005.png b/04-tracking-image-features/cornerness_harris/images/img0005.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0005.png rename to 04-tracking-image-features/cornerness_harris/images/img0005.png diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0006.jpg b/04-tracking-image-features/cornerness_harris/images/img0006.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0006.jpg rename to 04-tracking-image-features/cornerness_harris/images/img0006.jpg diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0006.png b/04-tracking-image-features/cornerness_harris/images/img0006.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0006.png rename to 04-tracking-image-features/cornerness_harris/images/img0006.png diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0007.jpg b/04-tracking-image-features/cornerness_harris/images/img0007.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0007.jpg rename to 04-tracking-image-features/cornerness_harris/images/img0007.jpg diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0007.png b/04-tracking-image-features/cornerness_harris/images/img0007.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0007.png rename to 04-tracking-image-features/cornerness_harris/images/img0007.png diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0008.jpg b/04-tracking-image-features/cornerness_harris/images/img0008.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0008.jpg rename to 04-tracking-image-features/cornerness_harris/images/img0008.jpg diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0008.png b/04-tracking-image-features/cornerness_harris/images/img0008.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0008.png rename to 04-tracking-image-features/cornerness_harris/images/img0008.png diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0009.jpg b/04-tracking-image-features/cornerness_harris/images/img0009.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0009.jpg rename to 04-tracking-image-features/cornerness_harris/images/img0009.jpg diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0009.png b/04-tracking-image-features/cornerness_harris/images/img0009.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img0009.png rename to 04-tracking-image-features/cornerness_harris/images/img0009.png diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img1.png b/04-tracking-image-features/cornerness_harris/images/img1.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img1.png rename to 04-tracking-image-features/cornerness_harris/images/img1.png diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img1gray.png b/04-tracking-image-features/cornerness_harris/images/img1gray.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img1gray.png rename to 04-tracking-image-features/cornerness_harris/images/img1gray.png diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img2gray.png b/04-tracking-image-features/cornerness_harris/images/img2gray.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/images/img2gray.png rename to 04-tracking-image-features/cornerness_harris/images/img2gray.png diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/solution/cornerness_harris.cpp b/04-tracking-image-features/cornerness_harris/solution/cornerness_harris.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/solution/cornerness_harris.cpp rename to 04-tracking-image-features/cornerness_harris/solution/cornerness_harris.cpp diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/src/cornerness_harris.cpp b/04-tracking-image-features/cornerness_harris/src/cornerness_harris.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/src/cornerness_harris.cpp rename to 04-tracking-image-features/cornerness_harris/src/cornerness_harris.cpp diff --git a/04-tracking-image-features/describe-keypoints/CMakeLists.txt b/04-tracking-image-features/describe-keypoints/CMakeLists.txt new file mode 100644 index 00000000..336e61ca --- /dev/null +++ b/04-tracking-image-features/describe-keypoints/CMakeLists.txt @@ -0,0 +1,23 @@ +# 04-tracking-image-features/describe-keypoints/CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) + +project(sfnd-camera LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CXX_FLAGS "-Wall") +set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") + +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() + +# Include OpenCV headers +include_directories(${OpenCV_INCLUDE_DIRS}) +link_directories(${OpenCV_LIBRARY_DIRS}) +add_definitions(${OpenCV_DEFINITIONS}) + +# Executables for exercise +add_executable (describe_keypoints src/describe_keypoints.cpp) +target_link_libraries (describe_keypoints ${OpenCV_LIBRARIES}) diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0005.jpg b/04-tracking-image-features/describe-keypoints/images/img0005.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0005.jpg rename to 04-tracking-image-features/describe-keypoints/images/img0005.jpg diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0005.png b/04-tracking-image-features/describe-keypoints/images/img0005.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0005.png rename to 04-tracking-image-features/describe-keypoints/images/img0005.png diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0006.jpg b/04-tracking-image-features/describe-keypoints/images/img0006.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0006.jpg rename to 04-tracking-image-features/describe-keypoints/images/img0006.jpg diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0006.png b/04-tracking-image-features/describe-keypoints/images/img0006.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0006.png rename to 04-tracking-image-features/describe-keypoints/images/img0006.png diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0007.jpg b/04-tracking-image-features/describe-keypoints/images/img0007.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0007.jpg rename to 04-tracking-image-features/describe-keypoints/images/img0007.jpg diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0007.png b/04-tracking-image-features/describe-keypoints/images/img0007.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0007.png rename to 04-tracking-image-features/describe-keypoints/images/img0007.png diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0008.jpg b/04-tracking-image-features/describe-keypoints/images/img0008.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0008.jpg rename to 04-tracking-image-features/describe-keypoints/images/img0008.jpg diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0008.png b/04-tracking-image-features/describe-keypoints/images/img0008.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0008.png rename to 04-tracking-image-features/describe-keypoints/images/img0008.png diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0009.jpg b/04-tracking-image-features/describe-keypoints/images/img0009.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0009.jpg rename to 04-tracking-image-features/describe-keypoints/images/img0009.jpg diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0009.png b/04-tracking-image-features/describe-keypoints/images/img0009.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img0009.png rename to 04-tracking-image-features/describe-keypoints/images/img0009.png diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img1.png b/04-tracking-image-features/describe-keypoints/images/img1.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img1.png rename to 04-tracking-image-features/describe-keypoints/images/img1.png diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img1gray.png b/04-tracking-image-features/describe-keypoints/images/img1gray.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img1gray.png rename to 04-tracking-image-features/describe-keypoints/images/img1gray.png diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img2gray.png b/04-tracking-image-features/describe-keypoints/images/img2gray.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/images/img2gray.png rename to 04-tracking-image-features/describe-keypoints/images/img2gray.png diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/solution/describe_keypoints.cpp b/04-tracking-image-features/describe-keypoints/solution/describe_keypoints.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/solution/describe_keypoints.cpp rename to 04-tracking-image-features/describe-keypoints/solution/describe_keypoints.cpp diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/src/describe_keypoints.cpp b/04-tracking-image-features/describe-keypoints/src/describe_keypoints.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/src/describe_keypoints.cpp rename to 04-tracking-image-features/describe-keypoints/src/describe_keypoints.cpp diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/CMakeLists.txt b/04-tracking-image-features/descriptor-matching/CMakeLists.txt similarity index 51% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/CMakeLists.txt rename to 04-tracking-image-features/descriptor-matching/CMakeLists.txt index 8aeb4873..38dddede 100644 --- a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/CMakeLists.txt +++ b/04-tracking-image-features/descriptor-matching/CMakeLists.txt @@ -1,14 +1,19 @@ -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +# 04-tracking-image-features/descriptor-matching/CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -add_definitions(-std=c++11) +project(sfnd-camera LANGUAGES CXX) -set(CXX_FLAGS "-Wall" "-pedantic") -set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -project(camera_fusion) +set(CXX_FLAGS "-Wall") +set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") -find_package(OpenCV 4.1 REQUIRED) +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() +# Include OpenCV headers include_directories(${OpenCV_INCLUDE_DIRS}) link_directories(${OpenCV_LIBRARY_DIRS}) add_definitions(${OpenCV_DEFINITIONS}) diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescRef_BRISK_large.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_DescRef_BRISK_large.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescRef_BRISK_large.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_DescRef_BRISK_large.dat diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescRef_BRISK_small.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_DescRef_BRISK_small.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescRef_BRISK_small.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_DescRef_BRISK_small.dat diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescRef_SIFT.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_DescRef_SIFT.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescRef_SIFT.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_DescRef_SIFT.dat diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescSource_BRISK_large.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_DescSource_BRISK_large.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescSource_BRISK_large.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_DescSource_BRISK_large.dat diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescSource_BRISK_small.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_DescSource_BRISK_small.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescSource_BRISK_small.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_DescSource_BRISK_small.dat diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescSource_SIFT.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_DescSource_SIFT.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_DescSource_SIFT.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_DescSource_SIFT.dat diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsRef_BRISK_large.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_KptsRef_BRISK_large.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsRef_BRISK_large.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_KptsRef_BRISK_large.dat diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsRef_BRISK_small.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_KptsRef_BRISK_small.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsRef_BRISK_small.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_KptsRef_BRISK_small.dat diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsRef_SIFT.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_KptsRef_SIFT.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsRef_SIFT.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_KptsRef_SIFT.dat diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsSource_BRISK_large.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_KptsSource_BRISK_large.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsSource_BRISK_large.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_KptsSource_BRISK_large.dat diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsSource_BRISK_small.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_KptsSource_BRISK_small.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsSource_BRISK_small.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_KptsSource_BRISK_small.dat diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsSource_SIFT.dat b/04-tracking-image-features/descriptor-matching/dat/C35A5_KptsSource_SIFT.dat similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/dat/C35A5_KptsSource_SIFT.dat rename to 04-tracking-image-features/descriptor-matching/dat/C35A5_KptsSource_SIFT.dat diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0005.jpg b/04-tracking-image-features/descriptor-matching/images/img0005.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0005.jpg rename to 04-tracking-image-features/descriptor-matching/images/img0005.jpg diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0005.png b/04-tracking-image-features/descriptor-matching/images/img0005.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0005.png rename to 04-tracking-image-features/descriptor-matching/images/img0005.png diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0006.jpg b/04-tracking-image-features/descriptor-matching/images/img0006.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0006.jpg rename to 04-tracking-image-features/descriptor-matching/images/img0006.jpg diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0006.png b/04-tracking-image-features/descriptor-matching/images/img0006.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0006.png rename to 04-tracking-image-features/descriptor-matching/images/img0006.png diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0007.jpg b/04-tracking-image-features/descriptor-matching/images/img0007.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0007.jpg rename to 04-tracking-image-features/descriptor-matching/images/img0007.jpg diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0007.png b/04-tracking-image-features/descriptor-matching/images/img0007.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0007.png rename to 04-tracking-image-features/descriptor-matching/images/img0007.png diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0008.jpg b/04-tracking-image-features/descriptor-matching/images/img0008.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0008.jpg rename to 04-tracking-image-features/descriptor-matching/images/img0008.jpg diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0008.png b/04-tracking-image-features/descriptor-matching/images/img0008.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0008.png rename to 04-tracking-image-features/descriptor-matching/images/img0008.png diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0009.jpg b/04-tracking-image-features/descriptor-matching/images/img0009.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0009.jpg rename to 04-tracking-image-features/descriptor-matching/images/img0009.jpg diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0009.png b/04-tracking-image-features/descriptor-matching/images/img0009.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img0009.png rename to 04-tracking-image-features/descriptor-matching/images/img0009.png diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img1.png b/04-tracking-image-features/descriptor-matching/images/img1.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img1.png rename to 04-tracking-image-features/descriptor-matching/images/img1.png diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img1gray.png b/04-tracking-image-features/descriptor-matching/images/img1gray.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img1gray.png rename to 04-tracking-image-features/descriptor-matching/images/img1gray.png diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img2gray.png b/04-tracking-image-features/descriptor-matching/images/img2gray.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/images/img2gray.png rename to 04-tracking-image-features/descriptor-matching/images/img2gray.png diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/solution/descriptor_matching.cpp b/04-tracking-image-features/descriptor-matching/solution/descriptor_matching.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/solution/descriptor_matching.cpp rename to 04-tracking-image-features/descriptor-matching/solution/descriptor_matching.cpp diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/src/dataStructures.h b/04-tracking-image-features/descriptor-matching/src/dataStructures.h similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/src/dataStructures.h rename to 04-tracking-image-features/descriptor-matching/src/dataStructures.h diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/src/descriptor_matching.cpp b/04-tracking-image-features/descriptor-matching/src/descriptor_matching.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/src/descriptor_matching.cpp rename to 04-tracking-image-features/descriptor-matching/src/descriptor_matching.cpp diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/src/structIO.cpp b/04-tracking-image-features/descriptor-matching/src/structIO.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/src/structIO.cpp rename to 04-tracking-image-features/descriptor-matching/src/structIO.cpp diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/src/structIO.hpp b/04-tracking-image-features/descriptor-matching/src/structIO.hpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Descriptor Matching/descriptor_matching/src/structIO.hpp rename to 04-tracking-image-features/descriptor-matching/src/structIO.hpp diff --git a/04-tracking-image-features/detect_keypoints/CMakeLists.txt b/04-tracking-image-features/detect_keypoints/CMakeLists.txt new file mode 100644 index 00000000..9a551078 --- /dev/null +++ b/04-tracking-image-features/detect_keypoints/CMakeLists.txt @@ -0,0 +1,23 @@ +# 04-tracking-image-features/detect-keypoints/CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) + +project(sfnd-camera LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CXX_FLAGS "-Wall") +set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") + +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() + +# Include OpenCV headers +include_directories(${OpenCV_INCLUDE_DIRS}) +link_directories(${OpenCV_LIBRARY_DIRS}) +add_definitions(${OpenCV_DEFINITIONS}) + +# Executables for exercise +add_executable (detect_keypoints src/detect_keypoints.cpp) +target_link_libraries (detect_keypoints ${OpenCV_LIBRARIES}) diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0005.jpg b/04-tracking-image-features/detect_keypoints/images/img0005.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0005.jpg rename to 04-tracking-image-features/detect_keypoints/images/img0005.jpg diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0005.png b/04-tracking-image-features/detect_keypoints/images/img0005.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0005.png rename to 04-tracking-image-features/detect_keypoints/images/img0005.png diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0006.jpg b/04-tracking-image-features/detect_keypoints/images/img0006.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0006.jpg rename to 04-tracking-image-features/detect_keypoints/images/img0006.jpg diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0006.png b/04-tracking-image-features/detect_keypoints/images/img0006.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0006.png rename to 04-tracking-image-features/detect_keypoints/images/img0006.png diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0007.jpg b/04-tracking-image-features/detect_keypoints/images/img0007.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0007.jpg rename to 04-tracking-image-features/detect_keypoints/images/img0007.jpg diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0007.png b/04-tracking-image-features/detect_keypoints/images/img0007.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0007.png rename to 04-tracking-image-features/detect_keypoints/images/img0007.png diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0008.jpg b/04-tracking-image-features/detect_keypoints/images/img0008.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0008.jpg rename to 04-tracking-image-features/detect_keypoints/images/img0008.jpg diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0008.png b/04-tracking-image-features/detect_keypoints/images/img0008.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0008.png rename to 04-tracking-image-features/detect_keypoints/images/img0008.png diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0009.jpg b/04-tracking-image-features/detect_keypoints/images/img0009.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0009.jpg rename to 04-tracking-image-features/detect_keypoints/images/img0009.jpg diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0009.png b/04-tracking-image-features/detect_keypoints/images/img0009.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img0009.png rename to 04-tracking-image-features/detect_keypoints/images/img0009.png diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img1.png b/04-tracking-image-features/detect_keypoints/images/img1.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img1.png rename to 04-tracking-image-features/detect_keypoints/images/img1.png diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img1gray.png b/04-tracking-image-features/detect_keypoints/images/img1gray.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img1gray.png rename to 04-tracking-image-features/detect_keypoints/images/img1gray.png diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img2gray.png b/04-tracking-image-features/detect_keypoints/images/img2gray.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/images/img2gray.png rename to 04-tracking-image-features/detect_keypoints/images/img2gray.png diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/solution/detect_keypoints.cpp b/04-tracking-image-features/detect_keypoints/solution/detect_keypoints.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/solution/detect_keypoints.cpp rename to 04-tracking-image-features/detect_keypoints/solution/detect_keypoints.cpp diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/src/detect_keypoints.cpp b/04-tracking-image-features/detect_keypoints/src/detect_keypoints.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/src/detect_keypoints.cpp rename to 04-tracking-image-features/detect_keypoints/src/detect_keypoints.cpp diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/CMakeLists.txt b/04-tracking-image-features/gradient-filtering/CMakeLists.txt similarity index 63% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/CMakeLists.txt rename to 04-tracking-image-features/gradient-filtering/CMakeLists.txt index ab9c5451..ed6ef877 100644 --- a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/CMakeLists.txt +++ b/04-tracking-image-features/gradient-filtering/CMakeLists.txt @@ -1,14 +1,20 @@ -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +# 04-tracking-image-features/gradient-filtering/CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -add_definitions(-std=c++11) +project(sfnd-camera LANGUAGES CXX) -set(CXX_FLAGS "-Wall" "-pedantic") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CXX_FLAGS "-Wall") set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") -project(camera_fusion) +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() -find_package(OpenCV 4.1 REQUIRED) +# Include OpenCV headers include_directories(${OpenCV_INCLUDE_DIRS}) link_directories(${OpenCV_LIBRARY_DIRS}) add_definitions(${OpenCV_DEFINITIONS}) diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0005.jpg b/04-tracking-image-features/gradient-filtering/images/img0005.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0005.jpg rename to 04-tracking-image-features/gradient-filtering/images/img0005.jpg diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0005.png b/04-tracking-image-features/gradient-filtering/images/img0005.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0005.png rename to 04-tracking-image-features/gradient-filtering/images/img0005.png diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0006.jpg b/04-tracking-image-features/gradient-filtering/images/img0006.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0006.jpg rename to 04-tracking-image-features/gradient-filtering/images/img0006.jpg diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0006.png b/04-tracking-image-features/gradient-filtering/images/img0006.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0006.png rename to 04-tracking-image-features/gradient-filtering/images/img0006.png diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0007.jpg b/04-tracking-image-features/gradient-filtering/images/img0007.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0007.jpg rename to 04-tracking-image-features/gradient-filtering/images/img0007.jpg diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0007.png b/04-tracking-image-features/gradient-filtering/images/img0007.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0007.png rename to 04-tracking-image-features/gradient-filtering/images/img0007.png diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0008.jpg b/04-tracking-image-features/gradient-filtering/images/img0008.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0008.jpg rename to 04-tracking-image-features/gradient-filtering/images/img0008.jpg diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0008.png b/04-tracking-image-features/gradient-filtering/images/img0008.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0008.png rename to 04-tracking-image-features/gradient-filtering/images/img0008.png diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0009.jpg b/04-tracking-image-features/gradient-filtering/images/img0009.jpg similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0009.jpg rename to 04-tracking-image-features/gradient-filtering/images/img0009.jpg diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0009.png b/04-tracking-image-features/gradient-filtering/images/img0009.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img0009.png rename to 04-tracking-image-features/gradient-filtering/images/img0009.png diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img1.png b/04-tracking-image-features/gradient-filtering/images/img1.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img1.png rename to 04-tracking-image-features/gradient-filtering/images/img1.png diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img1gray.png b/04-tracking-image-features/gradient-filtering/images/img1gray.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img1gray.png rename to 04-tracking-image-features/gradient-filtering/images/img1gray.png diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img2gray.png b/04-tracking-image-features/gradient-filtering/images/img2gray.png similarity index 100% rename from Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/images/img2gray.png rename to 04-tracking-image-features/gradient-filtering/images/img2gray.png diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/solutions/gaussian_smoothing.cpp b/04-tracking-image-features/gradient-filtering/solutions/gaussian_smoothing.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/solutions/gaussian_smoothing.cpp rename to 04-tracking-image-features/gradient-filtering/solutions/gaussian_smoothing.cpp diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/solutions/magnitude_sobel.cpp b/04-tracking-image-features/gradient-filtering/solutions/magnitude_sobel.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/solutions/magnitude_sobel.cpp rename to 04-tracking-image-features/gradient-filtering/solutions/magnitude_sobel.cpp diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/src/gaussian_smoothing.cpp b/04-tracking-image-features/gradient-filtering/src/gaussian_smoothing.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/src/gaussian_smoothing.cpp rename to 04-tracking-image-features/gradient-filtering/src/gaussian_smoothing.cpp diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/src/gradient_sobel.cpp b/04-tracking-image-features/gradient-filtering/src/gradient_sobel.cpp similarity index 100% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/src/gradient_sobel.cpp rename to 04-tracking-image-features/gradient-filtering/src/gradient_sobel.cpp diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/src/magnitude_sobel.cpp b/04-tracking-image-features/gradient-filtering/src/magnitude_sobel.cpp similarity index 96% rename from Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/src/magnitude_sobel.cpp rename to 04-tracking-image-features/gradient-filtering/src/magnitude_sobel.cpp index cb4c4a91..f3f7ff42 100644 --- a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/gradient_filtering/src/magnitude_sobel.cpp +++ b/04-tracking-image-features/gradient-filtering/src/magnitude_sobel.cpp @@ -33,7 +33,7 @@ void magnitudeSobel() // show result string windowName = "Gaussian Blurring"; cv::namedWindow(windowName, 1); // create window - cv::imshow(windowName, magnitude); + // cv::imshow(windowName, magnitude); cv::waitKey(0); // wait for keyboard input before continuing } diff --git a/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/CMakeLists.txt b/06-combining-camera-and-lidar/cluster-with-roi/CMakeLists.txt similarity index 50% rename from Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/CMakeLists.txt rename to 06-combining-camera-and-lidar/cluster-with-roi/CMakeLists.txt index 814ebe12..0b2607a8 100644 --- a/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/CMakeLists.txt +++ b/06-combining-camera-and-lidar/cluster-with-roi/CMakeLists.txt @@ -1,14 +1,19 @@ -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +# 06-combining-camera-and-lidar/cluster-with-roi/CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -add_definitions(-std=c++11) +project(sfnd-camera LANGUAGES CXX) -set(CXX_FLAGS "-Wall" "-pedantic") -set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -project(camera_fusion) +set(CXX_FLAGS "-Wall") +set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") -find_package(OpenCV 4.1 REQUIRED) +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() +# Include OpenCV headers include_directories(${OpenCV_INCLUDE_DIRS}) link_directories(${OpenCV_LIBRARY_DIRS}) add_definitions(${OpenCV_DEFINITIONS}) diff --git a/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/dat/C53A3_currBoundingBoxes.dat b/06-combining-camera-and-lidar/cluster-with-roi/dat/C53A3_currBoundingBoxes.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/dat/C53A3_currBoundingBoxes.dat rename to 06-combining-camera-and-lidar/cluster-with-roi/dat/C53A3_currBoundingBoxes.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/dat/C53A3_currLidarPts.dat b/06-combining-camera-and-lidar/cluster-with-roi/dat/C53A3_currLidarPts.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/dat/C53A3_currLidarPts.dat rename to 06-combining-camera-and-lidar/cluster-with-roi/dat/C53A3_currLidarPts.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/solution/clusterLidarWithROI.cpp b/06-combining-camera-and-lidar/cluster-with-roi/solution/clusterLidarWithROI.cpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/solution/clusterLidarWithROI.cpp rename to 06-combining-camera-and-lidar/cluster-with-roi/solution/clusterLidarWithROI.cpp diff --git a/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/src/cluster_with_roi.cpp b/06-combining-camera-and-lidar/cluster-with-roi/src/cluster_with_roi.cpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/src/cluster_with_roi.cpp rename to 06-combining-camera-and-lidar/cluster-with-roi/src/cluster_with_roi.cpp diff --git a/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/src/dataStructures.h b/06-combining-camera-and-lidar/cluster-with-roi/src/dataStructures.h similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/src/dataStructures.h rename to 06-combining-camera-and-lidar/cluster-with-roi/src/dataStructures.h diff --git a/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/src/structIO.cpp b/06-combining-camera-and-lidar/cluster-with-roi/src/structIO.cpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/src/structIO.cpp rename to 06-combining-camera-and-lidar/cluster-with-roi/src/structIO.cpp diff --git a/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/src/structIO.hpp b/06-combining-camera-and-lidar/cluster-with-roi/src/structIO.hpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/cluster_with_roi/src/structIO.hpp rename to 06-combining-camera-and-lidar/cluster-with-roi/src/structIO.hpp diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/CMakeLists.txt b/06-combining-camera-and-lidar/lidar-to-camera/CMakeLists.txt similarity index 60% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/CMakeLists.txt rename to 06-combining-camera-and-lidar/lidar-to-camera/CMakeLists.txt index 777954e5..a9cb627b 100644 --- a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/CMakeLists.txt +++ b/06-combining-camera-and-lidar/lidar-to-camera/CMakeLists.txt @@ -1,14 +1,19 @@ -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +# 06-combining-camera-and-lidar/lidar-to-camera/CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -add_definitions(-std=c++11) +project(sfnd-camera LANGUAGES CXX) -set(CXX_FLAGS "-Wall" "-pedantic") -set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -project(camera_fusion) +set(CXX_FLAGS "-Wall") +set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") -find_package(OpenCV 4.1 REQUIRED) +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() +# Include OpenCV headers include_directories(${OpenCV_INCLUDE_DIRS}) link_directories(${OpenCV_LIBRARY_DIRS}) add_definitions(${OpenCV_DEFINITIONS}) diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0000.dat b/06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0000.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0000.dat rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0000.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0001.dat b/06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0001.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0001.dat rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0001.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0002.dat b/06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0002.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0002.dat rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0002.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0003.dat b/06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0003.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0003.dat rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0003.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0004.dat b/06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0004.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0004.dat rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0004.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0005.dat b/06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0005.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0005.dat rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0005.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0006.dat b/06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0006.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0006.dat rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0006.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0007.dat b/06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0007.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0007.dat rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0007.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0008.dat b/06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0008.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0008.dat rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0008.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0009.dat b/06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0009.dat similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/C51_LidarPts_0009.dat rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/C51_LidarPts_0009.dat diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/calib_cam_to_cam.txt b/06-combining-camera-and-lidar/lidar-to-camera/dat/calib_cam_to_cam.txt similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/calib_cam_to_cam.txt rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/calib_cam_to_cam.txt diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/calib_velo_to_cam.txt b/06-combining-camera-and-lidar/lidar-to-camera/dat/calib_velo_to_cam.txt similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/dat/calib_velo_to_cam.txt rename to 06-combining-camera-and-lidar/lidar-to-camera/dat/calib_velo_to_cam.txt diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/images/0000000000.png b/06-combining-camera-and-lidar/lidar-to-camera/images/0000000000.png similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/images/0000000000.png rename to 06-combining-camera-and-lidar/lidar-to-camera/images/0000000000.png diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/images/s_thrun.jpg b/06-combining-camera-and-lidar/lidar-to-camera/images/s_thrun.jpg similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/images/s_thrun.jpg rename to 06-combining-camera-and-lidar/lidar-to-camera/images/s_thrun.jpg diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/solutions/filter_lidar_points.cpp b/06-combining-camera-and-lidar/lidar-to-camera/solutions/filter_lidar_points.cpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/solutions/filter_lidar_points.cpp rename to 06-combining-camera-and-lidar/lidar-to-camera/solutions/filter_lidar_points.cpp diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/solutions/project_lidar_to_camera.cpp b/06-combining-camera-and-lidar/lidar-to-camera/solutions/project_lidar_to_camera.cpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/solutions/project_lidar_to_camera.cpp rename to 06-combining-camera-and-lidar/lidar-to-camera/solutions/project_lidar_to_camera.cpp diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/solutions/show_lidar_top_view.cpp b/06-combining-camera-and-lidar/lidar-to-camera/solutions/show_lidar_top_view.cpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/solutions/show_lidar_top_view.cpp rename to 06-combining-camera-and-lidar/lidar-to-camera/solutions/show_lidar_top_view.cpp diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/src/dataStructures.h b/06-combining-camera-and-lidar/lidar-to-camera/src/dataStructures.h similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/src/dataStructures.h rename to 06-combining-camera-and-lidar/lidar-to-camera/src/dataStructures.h diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/src/project_lidar_to_camera.cpp b/06-combining-camera-and-lidar/lidar-to-camera/src/project_lidar_to_camera.cpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/src/project_lidar_to_camera.cpp rename to 06-combining-camera-and-lidar/lidar-to-camera/src/project_lidar_to_camera.cpp diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/src/show_lidar_top_view.cpp b/06-combining-camera-and-lidar/lidar-to-camera/src/show_lidar_top_view.cpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/src/show_lidar_top_view.cpp rename to 06-combining-camera-and-lidar/lidar-to-camera/src/show_lidar_top_view.cpp diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/src/structIO.cpp b/06-combining-camera-and-lidar/lidar-to-camera/src/structIO.cpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/src/structIO.cpp rename to 06-combining-camera-and-lidar/lidar-to-camera/src/structIO.cpp diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/src/structIO.hpp b/06-combining-camera-and-lidar/lidar-to-camera/src/structIO.hpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/lidar_to_camera/src/structIO.hpp rename to 06-combining-camera-and-lidar/lidar-to-camera/src/structIO.hpp diff --git a/06-combining-camera-and-lidar/object-detection-yolo/CMakeLists.txt b/06-combining-camera-and-lidar/object-detection-yolo/CMakeLists.txt new file mode 100644 index 00000000..2d098ad1 --- /dev/null +++ b/06-combining-camera-and-lidar/object-detection-yolo/CMakeLists.txt @@ -0,0 +1,23 @@ +# 06-combining-camera-and-lidar/object-detection-yolo/CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) + +project(sfnd-camera LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CXX_FLAGS "-Wall") +set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") + +if(NOT OpenCV_FOUND) + find_package(OpenCV REQUIRED) +endif() + +# Include OpenCV headers +include_directories(${OpenCV_INCLUDE_DIRS}) +link_directories(${OpenCV_LIBRARY_DIRS}) +add_definitions(${OpenCV_DEFINITIONS}) + +# Executables for exercises +add_executable (detect_objects src/detect_objects_2.cpp) +target_link_libraries (detect_objects ${OpenCV_LIBRARIES}) \ No newline at end of file diff --git a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/dat/yolo/coco.names b/06-combining-camera-and-lidar/object-detection-yolo/dat/yolo/coco.names similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/dat/yolo/coco.names rename to 06-combining-camera-and-lidar/object-detection-yolo/dat/yolo/coco.names diff --git a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/dat/yolo/yolov3-tiny.cfg b/06-combining-camera-and-lidar/object-detection-yolo/dat/yolo/yolov3-tiny.cfg similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/dat/yolo/yolov3-tiny.cfg rename to 06-combining-camera-and-lidar/object-detection-yolo/dat/yolo/yolov3-tiny.cfg diff --git a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/dat/yolo/yolov3-tiny.weights b/06-combining-camera-and-lidar/object-detection-yolo/dat/yolo/yolov3-tiny.weights similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/dat/yolo/yolov3-tiny.weights rename to 06-combining-camera-and-lidar/object-detection-yolo/dat/yolo/yolov3-tiny.weights diff --git a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/dat/yolo/yolov3.cfg b/06-combining-camera-and-lidar/object-detection-yolo/dat/yolo/yolov3.cfg similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/dat/yolo/yolov3.cfg rename to 06-combining-camera-and-lidar/object-detection-yolo/dat/yolo/yolov3.cfg diff --git a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/dat/yolo/yolov3.weights b/06-combining-camera-and-lidar/object-detection-yolo/dat/yolo/yolov3.weights similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/dat/yolo/yolov3.weights rename to 06-combining-camera-and-lidar/object-detection-yolo/dat/yolo/yolov3.weights diff --git a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/images/0000000000.png b/06-combining-camera-and-lidar/object-detection-yolo/images/0000000000.png similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/images/0000000000.png rename to 06-combining-camera-and-lidar/object-detection-yolo/images/0000000000.png diff --git a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/images/s_thrun.jpg b/06-combining-camera-and-lidar/object-detection-yolo/images/s_thrun.jpg similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/images/s_thrun.jpg rename to 06-combining-camera-and-lidar/object-detection-yolo/images/s_thrun.jpg diff --git a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/src/dataStructures.h b/06-combining-camera-and-lidar/object-detection-yolo/src/dataStructures.h similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/src/dataStructures.h rename to 06-combining-camera-and-lidar/object-detection-yolo/src/dataStructures.h diff --git a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/src/detect_objects_2.cpp b/06-combining-camera-and-lidar/object-detection-yolo/src/detect_objects_2.cpp similarity index 100% rename from Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/src/detect_objects_2.cpp rename to 06-combining-camera-and-lidar/object-detection-yolo/src/detect_objects_2.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..1f4ef617 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +# CMakeLists.txt +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) +project(sfnd-camera LANGUAGES CXX) + +find_package(OpenCV REQUIRED) + +# ========================= +# Subprojects +# ========================= +add_subdirectory(01-playground) + +add_subdirectory(02-opencv-library) + +add_subdirectory(03-collision-detection-system/ttc-camera) +add_subdirectory(03-collision-detection-system/ttc-lidar) + +add_subdirectory(04-tracking-image-features/cornerness_harris) +add_subdirectory(04-tracking-image-features/describe-keypoints) +add_subdirectory(04-tracking-image-features/descriptor-matching) +add_subdirectory(04-tracking-image-features/detect_keypoints) +add_subdirectory(04-tracking-image-features/gradient-filtering) + +add_subdirectory(06-combining-camera-and-lidar/cluster-with-roi) +add_subdirectory(06-combining-camera-and-lidar/lidar-to-camera) +add_subdirectory(06-combining-camera-and-lidar/object-detection-yolo) + diff --git a/CODEOWNERS b/CODEOWNERS deleted file mode 100644 index 2a6bcb28..00000000 --- a/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @udacity/active-public-content \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..be76ef33 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,59 @@ +FROM ubuntu:22.04 + +# Set environment variables +ENV DEBIAN_FRONTEND=noninteractive +ENV OPENCV_VERSION=pcl-1.10.0 +ENV OPENCV_INSTALL_DIR= + +# Update and install required packages +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + git \ + ca-certificates \ + cmake \ + sudo \ + curl \ + clang-format \ + gdb + +WORKDIR /opt + +# OpenCV dependencies + +# Install required packages +RUN apt-get install -y --no-install-recommends \ + pkg-config \ + libgtk2.0-dev + +RUN git clone -b 4.10.0 https://github.com/opencv/opencv.git && \ + git clone -b 4.10.0 https://github.com/opencv/opencv_contrib.git + +# Build +RUN cd opencv && \ + cmake -S . -B build \ + -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules \ + -DCMAKE_BUILD_TYPE=Release && \ + cmake --build build && \ + cmake --install build + # && \ + # cd .. && rm -rf opencv opencv_contrib + +# Clean up to keep the image size small +RUN apt clean && \ + rm -rf /var/lib/apt/lists/* + +# Create a new user 'user' with sudo privileges +RUN useradd -m user && \ + echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/user && \ + chmod 0440 /etc/sudoers.d/user + +# Use sed to uncomment the force_color_prompt line in ~/.bashrc +RUN sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/g' /home/user/.bashrc + +# Switch to the 'user' you created +USER user + +WORKDIR /home/user + +# Default command +CMD ["/bin/bash"] diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/.student_bashrc b/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/.student_bashrc deleted file mode 100644 index caa91031..00000000 --- a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/.student_bashrc +++ /dev/null @@ -1 +0,0 @@ -cd /home/workspace/OpenCV_exercises \ No newline at end of file diff --git a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/CMakeLists.txt b/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/CMakeLists.txt deleted file mode 100644 index d60ee97a..00000000 --- a/Lesson 2 - Autonomous Vehicles and Computer Vision/The OpenCV Library/OpenCV_exercises/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) - -add_definitions(-std=c++11) - -set(CXX_FLAGS "-Wall") -set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") - -project(camera_fusion) - -find_package(OpenCV 4.1 REQUIRED) - -include_directories(${OpenCV_INCLUDE_DIRS}) -link_directories(${OpenCV_LIBRARY_DIRS}) -add_definitions(${OpenCV_DEFINITIONS}) - -# Executable for create matrix exercise -add_executable (create_matrix src/create_matrix.cpp) -target_link_libraries (create_matrix ${OpenCV_LIBRARIES}) - -# Executable for change pixels exercise -add_executable (change_pixels src/change_pixels.cpp) -target_link_libraries (change_pixels ${OpenCV_LIBRARIES}) - -# Executables for load image exercises -add_executable (load_image_1 src/load_image_1.cpp) -target_link_libraries(load_image_1 ${OpenCV_LIBRARIES}) - -add_executable (load_image_2 src/load_image_2.cpp) -target_link_libraries(load_image_2 ${OpenCV_LIBRARIES}) - -add_executable (load_image_3 src/load_image_3.cpp) -target_link_libraries(load_image_3 ${OpenCV_LIBRARIES}) diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/.student_bashrc b/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/.student_bashrc deleted file mode 100644 index b8342e91..00000000 --- a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Camera/.student_bashrc +++ /dev/null @@ -1 +0,0 @@ -cd /home/workspace/TTC_camera \ No newline at end of file diff --git a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/.student_bashrc b/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/.student_bashrc deleted file mode 100644 index e113bdb1..00000000 --- a/Lesson 3 - Engineering a Collision Detection System/Estimating TTC with Lidar/.student_bashrc +++ /dev/null @@ -1 +0,0 @@ -cd /home/workspace/TTC_lidar \ No newline at end of file diff --git a/Lesson 4 - Tracking Image Features/Descriptor Matching/.student_bashrc b/Lesson 4 - Tracking Image Features/Descriptor Matching/.student_bashrc deleted file mode 100644 index d8cf56dd..00000000 --- a/Lesson 4 - Tracking Image Features/Descriptor Matching/.student_bashrc +++ /dev/null @@ -1 +0,0 @@ -cd /home/workspace/descriptor_matching \ No newline at end of file diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/.student_bashrc b/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/.student_bashrc deleted file mode 100644 index 87456a59..00000000 --- a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/.student_bashrc +++ /dev/null @@ -1 +0,0 @@ -cd /home/workspace/describe_keypoints \ No newline at end of file diff --git a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/CMakeLists.txt b/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/CMakeLists.txt deleted file mode 100644 index 9684e9c3..00000000 --- a/Lesson 4 - Tracking Image Features/Gradient-based vs. Binary Descriptors/describe_keypoints/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) - -add_definitions(-std=c++11) - -set(CXX_FLAGS "-Wall" "-pedantic") -set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") - -project(camera_fusion) - -find_package(OpenCV 4.1 REQUIRED) - -include_directories(${OpenCV_INCLUDE_DIRS}) -link_directories(${OpenCV_LIBRARY_DIRS}) -add_definitions(${OpenCV_DEFINITIONS}) - -# Executables for exercise -add_executable (describe_keypoints src/describe_keypoints.cpp) -target_link_libraries (describe_keypoints ${OpenCV_LIBRARIES}) diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/.student_bashrc b/Lesson 4 - Tracking Image Features/Harris Corner Detection/.student_bashrc deleted file mode 100644 index 0cf4c3a3..00000000 --- a/Lesson 4 - Tracking Image Features/Harris Corner Detection/.student_bashrc +++ /dev/null @@ -1 +0,0 @@ -cd /home/workspace/cornerness_harris \ No newline at end of file diff --git a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/CMakeLists.txt b/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/CMakeLists.txt deleted file mode 100644 index 13023d24..00000000 --- a/Lesson 4 - Tracking Image Features/Harris Corner Detection/cornerness_harris/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) - -add_definitions(-std=c++11) - -set(CXX_FLAGS "-Wall" "-pedantic") -set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") - -project(camera_fusion) - -find_package(OpenCV 4.1 REQUIRED) - -include_directories(${OpenCV_INCLUDE_DIRS}) -link_directories(${OpenCV_LIBRARY_DIRS}) -add_definitions(${OpenCV_DEFINITIONS}) - -# Executables for exercise -add_executable (cornerness_harris src/cornerness_harris.cpp) -target_link_libraries (cornerness_harris ${OpenCV_LIBRARIES}) diff --git a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/.student_bashrc b/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/.student_bashrc deleted file mode 100644 index c32a0504..00000000 --- a/Lesson 4 - Tracking Image Features/Intensity Gradient and Filtering/.student_bashrc +++ /dev/null @@ -1 +0,0 @@ -cd /home/workspace/gradient_filtering \ No newline at end of file diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/.student_bashrc b/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/.student_bashrc deleted file mode 100644 index 1e5b935d..00000000 --- a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/.student_bashrc +++ /dev/null @@ -1 +0,0 @@ -cd /home/workspace/detect_keypoints \ No newline at end of file diff --git a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/CMakeLists.txt b/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/CMakeLists.txt deleted file mode 100644 index d0b18c94..00000000 --- a/Lesson 4 - Tracking Image Features/Overview of Popular Keypoint Detectors/detect_keypoints/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) - -add_definitions(-std=c++11) - -set(CXX_FLAGS "-Wall" "-pedantic") -set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") - -project(camera_fusion) - -find_package(OpenCV 4.1 REQUIRED) - -include_directories(${OpenCV_INCLUDE_DIRS}) -link_directories(${OpenCV_LIBRARY_DIRS}) -add_definitions(${OpenCV_DEFINITIONS}) - -# Executables for exercise -add_executable (detect_keypoints src/detect_keypoints.cpp) -target_link_libraries (detect_keypoints ${OpenCV_LIBRARIES}) diff --git a/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/.student_bashrc b/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/.student_bashrc deleted file mode 100644 index 4b640017..00000000 --- a/Lesson 6 - Combining Camera and Lidar/Creating 3D-Objects/.student_bashrc +++ /dev/null @@ -1 +0,0 @@ -cd /home/workspace/cluster_with_roi \ No newline at end of file diff --git a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/.student_bashrc b/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/.student_bashrc deleted file mode 100644 index 138c4b7c..00000000 --- a/Lesson 6 - Combining Camera and Lidar/Lidar-to-Camera Point Projection/.student_bashrc +++ /dev/null @@ -1 +0,0 @@ -cd /home/workspace/lidar_to_camera \ No newline at end of file diff --git a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/.student_bashrc b/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/.student_bashrc deleted file mode 100644 index 8a642a38..00000000 --- a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/.student_bashrc +++ /dev/null @@ -1 +0,0 @@ -cd /home/workspace/detect_objects \ No newline at end of file diff --git a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/CMakeLists.txt b/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/CMakeLists.txt deleted file mode 100644 index 1446cc59..00000000 --- a/Lesson 6 - Combining Camera and Lidar/Object Detection with YOLO/detect_objects/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) - -add_definitions(-std=c++11) - -set(CXX_FLAGS "-Wall" "-pedantic") -set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}") - -project(camera_fusion) - -find_package(OpenCV 4.1 REQUIRED) - -include_directories(${OpenCV_INCLUDE_DIRS}) -link_directories(${OpenCV_LIBRARY_DIRS}) -add_definitions(${OpenCV_DEFINITIONS}) - -# Executables for exercises -add_executable (detect_objects src/detect_objects_2.cpp) -target_link_libraries (detect_objects ${OpenCV_LIBRARIES}) \ No newline at end of file diff --git a/README.md b/README.md index e9d1555a..ecf19ee6 100644 --- a/README.md +++ b/README.md @@ -93,4 +93,102 @@ git push --set-upstream origin ``` * Next, create a PR and merge the new branch with the remote master. - + +## Install OpenCV globally + +### To build all the projects + +```bash +cd ../../ +cmake -S . -B build +cmake --build build --config Release +cmake --build build --config Debug +``` + +- Set environment variables + - Binary + - OpenCV_DIR + +### To build specific projects in an isolated fashion (opencv needs to be available) + +```bash +cd 01-playground +cmake -S . -B build +cmake --build build --config Release +cmake --build build --config Debug +``` + +## Install OpenCV locally + +Clone the submodule repository: + +``` +git submodule update --init --recursive +``` + +Build the library + +```bash +cd third-party/opencv4.10 +cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../third-party/install + +cmake --build build --config Release +cmake --build build --config Debug +cmake --build build --config Release --target INSTALL # this will install at DCMAKE_INSTALL_PREFIX if defined otherwise build/install +cmake --build build --config Debug --target INSTALL +``` + +### To build all the projects + +```bash +cd ../../ +cmake -S . -B build +cmake --build build --config Release +cmake --build build --config Debug +``` + +### To build specific projects in an isolated fashion (opencv needs to be available) + +```bash +cd 01-playground +cmake -S . -B build +cmake --build build --config Release +cmake --build build --config Debug +``` + +To be able to run this should be added to your path. WARNING: This variable could already be set on the system / global environment variables, make sure to know where this is coming from and make sure to overwrite it if you want to use your custom installation. + +Powershell: + +```powershell +$env:PATH = "${PWD}\third-party\opencv4.10\build\x64\vc17\bin;" + $env:PATH +``` + +CMD: + +```cmd +set "PATH=\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\01-playground\..\third-party\opencv4.10\build\x64\vc17\bin;%PATH%" +``` + +Bash: + +```bash +PATH="/path/to/opencv/bin:$PATH" ./MyApp +``` + + +## Building only one project: + +Mention that this needs to be defined for finding a custom build of OpenCV also it might be needed to add the binary dir to the PATH. + +Doing this on your local session should overwrite a global installation if any. If nothing is set find_package() will throw an error. + +```bash +cmake -S . -B build -DOpenCV_DIR="../third-party/opencv4.10/build/install" +``` + +Or for more nested projects like : + +``` +cmake -S . -B build -DOpenCV_DIR="../../third-party/opencv4.10/build/install" +``` \ No newline at end of file diff --git a/cmake/FindOpenCVCustom.cmake b/cmake/FindOpenCVCustom.cmake new file mode 100644 index 00000000..41cf045b --- /dev/null +++ b/cmake/FindOpenCVCustom.cmake @@ -0,0 +1,52 @@ +# cmake/FindOpenCVCustom.cmake +function(find_opencv_custom LOCAL_OPENCV_PATH) + # Just unset normally (not from cache) to allow a clean attempt. + unset(OpenCV_DIR) + + message(STATUS "Attempting to find OpenCV locally at: ${LOCAL_OPENCV_PATH}") + find_package(OpenCV HINTS "${LOCAL_OPENCV_PATH}" NO_DEFAULT_PATH) + if(OpenCV_FOUND) + message(WARNING + "You need to add the following directory to your PATH:\n" + "${LOCAL_OPENCV_PATH}/x64/vc17/bin\n" + "If a global OpenCV is installed and in PATH, it might take precedence.\n" + ) + + # Store results in cache to persist for subdirectories + # set(OpenCV_FOUND ${OpenCV_FOUND} CACHE INTERNAL "OpenCV found") + # set(OpenCV_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} CACHE INTERNAL "OpenCV include dirs") + # set(OpenCV_LIBS ${OpenCV_LIBS} CACHE INTERNAL "OpenCV libs") + set(OpenCV_FOUND ${OpenCV_FOUND} CACHE BOOL "OpenCV found" FORCE) + set(OpenCV_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} CACHE PATH "OpenCV include dirs" FORCE) + set(OpenCV_LIBS ${OpenCV_LIBS} CACHE STRING "OpenCV libs" FORCE) + return() + endif() + + message(WARNING "OpenCV not found locally. Trying global installation...") + unset(OpenCV_DIR) + find_package(OpenCV REQUIRED) + if(OpenCV_FOUND) + # Store results in cache to persist for subdirectories + # set(OpenCV_FOUND ${OpenCV_FOUND} CACHE INTERNAL "OpenCV found") + # set(OpenCV_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} CACHE INTERNAL "OpenCV include dirs") + # set(OpenCV_LIBS ${OpenCV_LIBS} CACHE INTERNAL "OpenCV libs") + set(OpenCV_FOUND ${OpenCV_FOUND} CACHE BOOL "OpenCV found" FORCE) + set(OpenCV_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} CACHE PATH "OpenCV include dirs" FORCE) + set(OpenCV_LIBS ${OpenCV_LIBS} CACHE STRING "OpenCV libs" FORCE) + endif() +endfunction() + + +# NOTE: Be mindful when using install because it could contains both Release and Debug together. This is dependent on how the project was built +# set(OpenCV_DIR "${CMAKE_SOURCE_DIR}/third-party/opencv4.10/build/install") +# set(OpenCV_DIR "${CMAKE_SOURCE_DIR}/third-party/install") # -> This was installed with a prefix + +# NOTE: Be mindful when using install because it contains either Release or Debug +# set(OpenCV_DIR "${CMAKE_SOURCE_DIR}/../third-party/opencv4.10/build/win-install/") -> This doesn't work it's just for stating at installation +# set(OpenCV_DIR "${CMAKE_SOURCE_DIR}/../third-party/opencv4.10/build/win-install/x64/vc17/lib") -> This doesn't work it's just for stating at installation +# set(OpenCV_DIR "${CMAKE_SOURCE_DIR}/../third-party/opencv4.10/build/install/") # This only exists after install +# set(OpenCV_DIR "${CMAKE_SOURCE_DIR}/../third-party/opencv4.10/build/install/x64/vc17/lib") + +# Local OpenCV directory (adjust to the actual location of OpenCVConfig.cmake) +# NOTE: This need to be set to overwrite sub projects definition of OpenCV_DIR, this doesn't need install +# set(LOCAL_OPENCV_PATH "${CMAKE_SOURCE_DIR}/third-party/opencv4.10/build") \ No newline at end of file diff --git a/docs/TODO b/docs/TODO new file mode 100644 index 00000000..e07013c3 --- /dev/null +++ b/docs/TODO @@ -0,0 +1,195 @@ +# CMakeLists.txt - Main +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) + +project(sfnd-camera LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# NOTE!! For large projects: +# ExternalProject_Add() is more scalable and flexible. +# add_subdirectory() is simpler but better suited for small, tightly integrated libraries. +# Most modern, large-scale projects prefer ExternalProject_Add() (or package managers like Conan or vcpkg) +# for managing third-party libraries efficiently. + +# ---------------------------------------------------------- +# Option 1: Build OpenCV from source with add_subdirectory() +# ---------------------------------------------------------- +# Add the OpenCV submodule as a subproject +# This will build OpenCV from the checked-out source +# add_subdirectory(third-party/opencv4.10) + +# Optionally, install OpenCV locally in a controlled path +# install(TARGETS opencv_core opencv_imgcodecs opencv_highgui +# EXPORT OpenCVTargets +# RUNTIME DESTINATION ${THIRD_PARTY_INSTALL_DIR}/bin +# LIBRARY DESTINATION ${THIRD_PARTY_INSTALL_DIR}/lib +# ARCHIVE DESTINATION ${THIRD_PARTY_INSTALL_DIR}/lib +# ) +# NOTE: Don't forget to run cmake --install for this be executed +# NOTE: This will inherit the BUILD_TYPE configuration not like option 2 + +# ------------------------------------------------------------- +# Option 2: Build OpenCV from source with ExternalProject_Add() +# ------------------------------------------------------------- + +# Set where the third-party libraries will be installed +set(THIRD_PARTY_INSTALL_DIR ${CMAKE_SOURCE_DIR}/third-party/install) + +include(ExternalProject) + +# Add the OpenCV external project, pointing to the submodule source +ExternalProject_Add( + opencv_external + PREFIX ${CMAKE_BINARY_DIR}/third-party/opencv4.10 + SOURCE_DIR ${CMAKE_SOURCE_DIR}/third-party/opencv4.10 + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_DIR}/opencv4.10 + # NOTE: If this is not configured then Release it's used by default and sub projects cannot be build in Debug Mode + -DCMAKE_CONFIGURATION_TYPES=Debug;Release + -DBUILD_SHARED_LIBS=ON + -DBUILD_TEST=OFF + -DBUILD_EXAMPLES=OFF + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $ + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config $ +) + +# Add a custom target to depend on OpenCV installation +# This ensures we build the libraries before referencing them +# add_custom_target(opencv_install DEPENDS opencv_external) + +# Find OpenCV only after the installation is done +# set(OpenCV_DIR "${CMAKE_SOURCE_DIR}/third-party/install/opencv4.10/x64/vc17/lib") + +# Import OpenCV after the external project is built +# find_package(OpenCV 4.10 REQUIRED PATHS ${OpenCV_DIR} NO_DEFAULT_PATH) + +# ========================= +# Subprojects +# ========================= + +# add_subdirectory(02-opencv-library) + +-------------------------------------------------------------------------------------------------------------------------------------------- + + +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) +project(sfnd-camera LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Include FetchContent to download external libraries +include(FetchContent) + +# Set a path for third-party libraries +set(THIRD_PARTY_INSTALL_DIR ${CMAKE_SOURCE_DIR}/third-party/install) + +# FetchContent for OpenCV +FetchContent_Declare( + opencv_prebuilt + URL https://github.com/opencv/opencv/releases/download/4.5.0/opencv-4.5.0-vc14_vc15.zip + URL_HASH SHA256=fc43ef67f73e28db28e8a6d3c2293346b208efc32cf40bb663e6a5c780c0efc3 + DOWNLOAD_EXTRACT_TIMESTAMP TRUE +) + +# Download and extract OpenCV +FetchContent_MakeAvailable(opencv_prebuilt) + +# Set OpenCV_DIR to the extracted location +set(OpenCV_DIR "${opencv_prebuilt_SOURCE_DIR}/build/x64/vc15/lib") + +# Find OpenCV +find_package(OpenCV REQUIRED PATHS ${OpenCV_DIR} NO_DEFAULT_PATH) + +if(OpenCV_FOUND) + message(STATUS "OpenCV found: ${OpenCV_VERSION}") + message(STATUS "OpenCV include dir: ${OpenCV_INCLUDE_DIRS}") + message(STATUS "OpenCV libraries: ${OpenCV_LIBS}") +else() + message(FATAL_ERROR "OpenCV not found. Check the FetchContent download.") +endif() + +# Include OpenCV headers +include_directories(${OpenCV_INCLUDE_DIRS}) + +# ========================= +# Subprojects +# ========================= +add_subdirectory(02-opencv-library) + + + +-------------------------------------------------------------------------------------------------------------------------------------------- + +# CMakeLists.txt - Main +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) + +project(sfnd-camera LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# NOTE!! For large projects: +# ExternalProject_Add() is more scalable and flexible. +# add_subdirectory() is simpler but better suited for small, tightly integrated libraries. +# Most modern, large-scale projects prefer ExternalProject_Add() (or package managers like Conan or vcpkg) +# for managing third-party libraries efficiently. + +# ---------------------------------------------------------- +# Option 1: Build OpenCV from source with add_subdirectory() +# ---------------------------------------------------------- +# Add the OpenCV submodule as a subproject +# This will build OpenCV from the checked-out source +# add_subdirectory(third-party/opencv4.10) + +# Optionally, install OpenCV locally in a controlled path +# install(TARGETS opencv_core opencv_imgcodecs opencv_highgui +# EXPORT OpenCVTargets +# RUNTIME DESTINATION ${THIRD_PARTY_INSTALL_DIR}/bin +# LIBRARY DESTINATION ${THIRD_PARTY_INSTALL_DIR}/lib +# ARCHIVE DESTINATION ${THIRD_PARTY_INSTALL_DIR}/lib +# ) +# NOTE: Don't forget to run cmake --install for this be executed +# NOTE: This will inherit the BUILD_TYPE configuration not like option 2 + +# ------------------------------------------------------------- +# Option 2: Build OpenCV from source with ExternalProject_Add() +# ------------------------------------------------------------- + +# Set where the third-party libraries will be installed +set(THIRD_PARTY_INSTALL_DIR ${CMAKE_SOURCE_DIR}/third-party/install) + +include(ExternalProject) + +# Add the OpenCV external project, pointing to the submodule source +ExternalProject_Add( + opencv_external + PREFIX ${CMAKE_BINARY_DIR}/third-party/opencv4.10 + SOURCE_DIR ${CMAKE_SOURCE_DIR}/third-party/opencv4.10 + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_DIR}/opencv4.10 + # NOTE: If this is not configured then Release it's used by default and sub projects cannot be build in Debug Mode + -DCMAKE_CONFIGURATION_TYPES=Debug;Release + -DBUILD_SHARED_LIBS=ON + -DBUILD_TEST=OFF + -DBUILD_EXAMPLES=OFF + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release +) + +# Add a custom target to depend on OpenCV installation +# This ensures we build the libraries before referencing them +# add_custom_target(opencv_install DEPENDS opencv_external) + +# Find OpenCV only after the installation is done +# set(OpenCV_DIR "${CMAKE_SOURCE_DIR}/third-party/install/opencv4.10/x64/vc17/lib") + +# Import OpenCV after the external project is built +# find_package(OpenCV 4.10 REQUIRED PATHS ${OpenCV_DIR} NO_DEFAULT_PATH) + +# ========================= +# Subprojects +# ========================= + +# add_subdirectory(02-opencv-library) \ No newline at end of file diff --git a/docs/cmake-windows-vs-linux.md b/docs/cmake-windows-vs-linux.md new file mode 100644 index 00000000..72354b55 --- /dev/null +++ b/docs/cmake-windows-vs-linux.md @@ -0,0 +1,190 @@ +When using **CMake with Visual Studio** (or other multi-configuration generators), the build type **is not specified during the configuration step** because Visual Studio supports multiple configurations (e.g., Debug, Release, RelWithDebInfo) **within the same project files**. Instead, you choose the build type at **build time**. + +--- + +### **Steps to Configure and Build on Windows with Visual Studio** + +1. **Configuration Step** + Generate Visual Studio project files with `cmake -S . -B build`. Do not set `CMAKE_BUILD_TYPE` because it’s ignored for multi-configuration generators like Visual Studio. + + Example: + ```bash + cmake -S . -B build -G "Visual Studio 17 2022" -A x64 + ``` + Here: + - `-G "Visual Studio 17 2022"` specifies the generator. + - `-A x64` sets the platform architecture (x64, Win32, or ARM). + +2. **Build Step** + Specify the build type (`Release`, `Debug`, etc.) when calling `cmake --build`. Use the `--config` flag to set the configuration. + + Example: + ```bash + cmake --build build --config Release + ``` + + - `--config Release` specifies the build type for Visual Studio. You can also use `Debug`, `RelWithDebInfo`, or `MinSizeRel`. + +--- + +### **Why `CMAKE_BUILD_TYPE` is Ignored on Windows** +- For single-configuration generators like **Makefiles** or **Ninja**, the `CMAKE_BUILD_TYPE` variable determines the build type at configuration time. +- For multi-configuration generators like **Visual Studio** or **Xcode**, you don’t need to predefine the build type during configuration. Instead, you select the build configuration when invoking the build command or through the IDE. + +--- + +### **Summary of Key Commands** + +1. **Generate Visual Studio project files**: + ```bash + cmake -S . -B build -G "Visual Studio 17 2022" -A x64 + ``` + +2. **Build a specific configuration**: + ```bash + cmake --build build --config Release + ``` + or + ```bash + cmake --build build --config Debug + ``` + +3. **Open the Visual Studio IDE**: + If you want to manually choose the configuration in Visual Studio: + - Open the generated `.sln` file in Visual Studio. + - Select the desired configuration (`Debug`, `Release`, etc.) from the dropdown menu in the toolbar. + - Build the project from within the IDE. + +--- + +### **Common Build Types** +When using Visual Studio, you have these standard build types: +- **Debug**: Includes debug symbols, no optimizations. +- **Release**: Optimized code, no debug symbols. +- **RelWithDebInfo**: Optimized code **with debug symbols** (useful for profiling and debugging). +- **MinSizeRel**: Optimized for minimum binary size. + +--- + +### **Recap** +- On Windows with Visual Studio, you specify the build configuration **at build time** using `--config`. +- Example: + ```bash + cmake --build build --config Release + ``` +- Alternatively, select the build type directly in the Visual Studio IDE. + +--- + +To keep both **Release** and **Debug** binaries on Linux, you need to use a **multi-configuration build setup** or organize your builds using separate output directories. + +### **Option 1: Use CMake's Multi-Config Generators** +While single-configuration generators like Makefiles and Ninja are common on Linux, CMake **supports multi-configuration generators** like **Ninja Multi-Config** starting with CMake 3.17. + +#### Steps: +1. **Configure with the Multi-Config Generator** + Use `-G "Ninja Multi-Config"` instead of the standard Ninja or Makefile generator. + + ```bash + cmake -S . -B build -G "Ninja Multi-Config" + ``` + +2. **Build Specific Configurations** + When building, you specify the desired configuration (e.g., Debug or Release) with `--config`. + + Example: + ```bash + cmake --build build --config Debug + cmake --build build --config Release + ``` + +3. **Output Location** + The binaries for each configuration will be placed in separate folders within the build directory: + ``` + build/ + ├── Debug/ + │ └── my_executable + └── Release/ + └── my_executable + ``` + +--- + +### **Option 2: Separate Build Directories for Debug and Release** +If you are using a **single-configuration generator** like Makefiles or Ninja (default on Linux), you can maintain separate build directories for each configuration. + +#### Steps: +1. **Configure Debug and Release in Separate Directories** + Run the configuration step twice with different `CMAKE_BUILD_TYPE` values, each targeting a unique build directory. + + ```bash + cmake -S . -B build/debug -DCMAKE_BUILD_TYPE=Debug + cmake -S . -B build/release -DCMAKE_BUILD_TYPE=Release + ``` + +2. **Build Debug and Release Binaries** + Build from each respective directory: + + ```bash + cmake --build build/debug + cmake --build build/release + ``` + +3. **Result** + The output binaries will be kept separate: + ``` + build/ + ├── debug/ + │ └── my_executable # Debug binary + └── release/ + └── my_executable # Release binary + ``` + +--- + +### **Option 3: Specify Output Paths for Each Configuration** +If you want to keep all configurations in the same build directory, you can use CMake variables like `CMAKE_RUNTIME_OUTPUT_DIRECTORY` to explicitly set where binaries are output. + +#### Steps: +1. **Modify `CMakeLists.txt`** + Add the following to your `CMakeLists.txt` to configure different output directories: + + ```cmake + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin/Debug) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin/Release) + ``` + + This tells CMake to place: + - Debug binaries in `build/bin/Debug` + - Release binaries in `build/bin/Release` + +2. **Configure and Build** + You still need separate configurations, but now CMake will respect the output paths: + + ```bash + cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug + cmake --build build + + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release + cmake --build build + ``` + +3. **Result** + Your binaries are organized under `bin/`: + ``` + build/ + ├── bin/ + │ ├── Debug/ + │ │ └── my_executable + │ └── Release/ + │ └── my_executable + ``` + +--- + +### **Recommendation** +The most common and cleanest approach for Linux is **Option 2: Separate Build Directories**. It avoids conflicts and works naturally with single-configuration generators like Makefiles or Ninja. + +If you're open to using **multi-config generators**, **Option 1** with **Ninja Multi-Config** provides a more modern solution. + +Let me know if you'd like a deeper dive into any of these approaches! 🚀 \ No newline at end of file diff --git a/docs/debug.md b/docs/debug.md new file mode 100644 index 00000000..a04cb081 --- /dev/null +++ b/docs/debug.md @@ -0,0 +1,815 @@ +## External Project + +### Attempt 1: + +```cmake +ExternalProject_Add( + opencv_external + # PREFIX ${CMAKE_BINARY_DIR}/third-party/opencv_build + SOURCE_DIR ${CMAKE_SOURCE_DIR}/third-party/opencv4.10 + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_DIR}/opencv4 + # -DCMAKE_BUILD_TYPE=Release + # -DCMAKE_CONFIGURATION_TYPES=Release # If this is not set it will attempt to build other configurations on Windows and cause and error + -DBUILD_SHARED_LIBS=ON + -DBUILD_TEST=OFF + -DBUILD_EXAMPLES=OFF +) +``` + +Commands: + +```bash +cmake -S . -B build +cmake --build build +cd 02-opencv-library +cmake -S . -B build +``` + +We get errors: + +```powershell +PS C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library> cmake -S . -B build +-- Building for: Visual Studio 17 2022 +-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631. +-- The CXX compiler identification is MSVC 19.35.32217.1 +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe - skipped +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- OpenCV_DIR is not set. Attempting to find OpenCV globally... +CMake Warning at CMakeLists.txt:22 (message): + OpenCV not found globally. Trying local installation... + + +-- Found OpenCV: 4.10.0 +-- OpenCV include path: C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/third-party/install/opencv4/include +-- OpenCV libraries: opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_gapi;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_stitching;opencv_video;opencv_videoio +-- Configuring done (3.0s) +CMake Error in CMakeLists.txt: + IMPORTED_IMPLIB not set for imported target "opencv_calib3d" configuration + "MinSizeRel". + + +CMake Error in CMakeLists.txt: + IMPORTED_IMPLIB not set for imported target "opencv_core" configuration + "MinSizeRel". + + +CMake Error in CMakeLists.txt: + IMPORTED_IMPLIB not set for imported target "opencv_dnn" configuration + "MinSizeRel". + +... + +Make Error in CMakeLists.txt: + IMPORTED_IMPLIB not set for imported target "opencv_gapi" configuration + "RelWithDebInfo". + + +CMake Error in CMakeLists.txt: + IMPORTED_IMPLIB not set for imported target "opencv_highgui" configuration + "RelWithDebInfo". + + +CMake Error in CMakeLists.txt: + IMPORTED_IMPLIB not set for imported target "opencv_imgcodecs" + configuration "RelWithDebInfo". + +... + +-- Generating done (0.3s) +CMake Warning: + Manually-specified variables were not used by the project: + + CMAKE_BUILD_TYPE + +``` + + + +### Attempt 2 + +```cmake +ExternalProject_Add( + opencv_external + # PREFIX ${CMAKE_BINARY_DIR}/third-party/opencv_build + SOURCE_DIR ${CMAKE_SOURCE_DIR}/third-party/opencv4.10 + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_DIR}/opencv4 + # -DCMAKE_BUILD_TYPE=Release + # -DCMAKE_CONFIGURATION_TYPES=Release # If this is not set it will attempt to build other configurations on Windows and cause and error + -DBUILD_SHARED_LIBS=ON + -DBUILD_TEST=OFF + -DBUILD_EXAMPLES=OFF +) +``` + +Commands: + +```bash +cmake -S . -B build +cmake --build build --config Release +cd 02-opencv-library +cmake -S . -B build # We passed this point +cmake --build build # ERROR here +``` + +ERROR: + +```powershell +PS C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library> cmake --build build +MSBuild version 17.5.1+f6fdcf537 for .NET Framework + + Checking Build System + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + change_pixels.cpp +change_pixels.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Cam +era\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl changePixels(void)" (?cha +ngePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcon +tainer\02-opencv-library\build\change_pixels.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\change_pixels.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + create_matrix.cpp +create_matrix.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_C +amera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl createMatrix1(void)" (?cr +eateMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devc +ontainer\02-opencv-library\build\create_matrix.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\create_matrix.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_1.cpp +load_image_1.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage1(void)" (?loadImage1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_1.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_1.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_1.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_2.cpp +load_image_2.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage2(void)" (?loadImage2@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_2.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_2.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_2.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_3.cpp +load_image_3.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage3(void)" (?loadImage3@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_3.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_3.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_3.vcxproj] +``` + +```bash +cmake -S . -B build +cmake --build build --config Release +cd 02-opencv-library +cmake -S . -B build # We passed this point +cmake --build build --config Release +``` + +SUCCES!! + +```powershell +PS C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library> cmake --build build --config Release +MSBuild version 17.5.1+f6fdcf537 for .NET Framework + + Checking Build System + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + change_pixels.cpp + change_pixels.vcxproj -> C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Release\change_pixels.exe + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + create_matrix.cpp + create_matrix.vcxproj -> C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Release\create_matrix.exe + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_1.cpp + load_image_1.vcxproj -> C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Release\load_image_1.exe + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_2.cpp + load_image_2.vcxproj -> C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Release\load_image_2.exe + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_3.cpp + load_image_3.vcxproj -> C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Release\load_image_3.exe + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt +``` + +### Attempt 3 + +```cmake +ExternalProject_Add( + opencv_external + PREFIX ${CMAKE_BINARY_DIR}/third-party/opencv4.10 + SOURCE_DIR ${CMAKE_SOURCE_DIR}/third-party/opencv4.10 + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_DIR}/opencv4.10 + # -DCMAKE_BUILD_TYPE=Release + # -DCMAKE_CONFIGURATION_TYPES=Release # If this is not set it will attempt to build other configurations on Windows and cause and error + -DBUILD_SHARED_LIBS=ON + -DBUILD_TEST=OFF + -DBUILD_EXAMPLES=OFF + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release + #INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release +) +``` + + +Commands: + +```bash +cmake -S . -B build +cmake --build build +cd 02-opencv-library +cmake -S . -B build # We passed this point +# cmake --build build # ERROR here +``` + +Same errors: + +```powershell + +... + +CMake Error in CMakeLists.txt: + IMPORTED_IMPLIB not set for imported target "opencv_objdetect" + configuration "RelWithDebInfo". +... + +``` + +### Attempt 4 + +```cmake +ExternalProject_Add( + opencv_external + PREFIX ${CMAKE_BINARY_DIR}/third-party/opencv4.10 + SOURCE_DIR ${CMAKE_SOURCE_DIR}/third-party/opencv4.10 + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_DIR}/opencv4.10 + # -DCMAKE_BUILD_TYPE=Release + # -DCMAKE_CONFIGURATION_TYPES=Release # If this is not set it will attempt to build other configurations on Windows and cause and error + -DBUILD_SHARED_LIBS=ON + -DBUILD_TEST=OFF + -DBUILD_EXAMPLES=OFF + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release +) +``` + + +Commands: + +```bash +cmake -S . -B build +cmake --build build +cd 02-opencvlibrary +cmake -S . -B build # We passed this point +cmake --build build # ERROR here +``` + +Errors + +```powershell + +PS C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library> cmake --build build +MSBuild version 17.5.1+f6fdcf537 for .NET Framework + + Checking Build System + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + change_pixels.cpp +change_pixels.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Cam +era\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl changePixels(void)" (?cha +ngePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcon +tainer\02-opencv-library\build\change_pixels.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\change_pixels.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + create_matrix.cpp +create_matrix.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_C +amera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl createMatrix1(void)" (?cr +eateMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devc +ontainer\02-opencv-library\build\create_matrix.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\create_matrix.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_1.cpp +load_image_1.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage1(void)" (?loadImage1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_1.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_1.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_1.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_2.cpp +load_image_2.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage2(void)" (?loadImage2@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_2.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_2.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_2.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_3.cpp +load_image_3.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage3(void)" (?loadImage3@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_3.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_3.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_3.vcxproj] + +``` + +Commands: + +```bash +cmake -S . -B build +cmake --build build +cd 02-opencv-library +cmake -S . -B build # We passed this point +cmake --build build --config Release +``` + +SUCCESS!! + +```bash +cmake --build build --config Debug # ERROR here +``` + +### Attemp 5 + +Try this: + +```cmake +ExternalProject_Add( + opencv_external + PREFIX ${CMAKE_BINARY_DIR}/third-party/opencv4.10 + SOURCE_DIR ${CMAKE_SOURCE_DIR}/third-party/opencv4.10 + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_DIR}/opencv4.10 + # -DCMAKE_BUILD_TYPE=Release + # -DCMAKE_CONFIGURATION_TYPES=Release # If this is not set it will attempt to build other configurations on Windows and cause and error + -DBUILD_SHARED_LIBS=ON + -DBUILD_TEST=OFF + -DBUILD_EXAMPLES=OFF + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release +) +``` + + +Commands: + +```bash +cmake -S . -B build +cmake --build build --target opencv_external +cd 02-opencv-library +cmake -S . -B build # We passed this point +cmake --build build # ERROR here +``` + +ERROR: + +```powershell +PS C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library> cmake --build build +MSBuild version 17.5.1+f6fdcf537 for .NET Framework + + Checking Build System + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + change_pixels.cpp +change_pixels.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Cam +era\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl changePixels(void)" (?cha +ngePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcon +tainer\02-opencv-library\build\change_pixels.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\change_pixels.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + create_matrix.cpp +create_matrix.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_C +amera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl createMatrix1(void)" (?cr +eateMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devc +ontainer\02-opencv-library\build\create_matrix.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\create_matrix.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_1.cpp +load_image_1.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage1(void)" (?loadImage1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_1.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_1.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_1.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_2.cpp +load_image_2.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage2(void)" (?loadImage2@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_2.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_2.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_2.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_3.cpp +load_image_3.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage3(void)" (?loadImage3@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_3.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_3.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_3.vcxproj] +``` + +```bash +cmake --build build --config Release +``` + +SUCCESS!! + + +```bash +cmake --build build --config Debug # ERROR here +``` + +```powershell +PS C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library> cmake --build build --config Debug +MSBuild version 17.5.1+f6fdcf537 for .NET Framework + +change_pixels.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Cam +era\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl changePixels(void)" (?cha +ngePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcon +tainer\02-opencv-library\build\change_pixels.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\change_pixels.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_C +amera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl createMatrix1(void)" (?cr +eateMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devc +ontainer\02-opencv-library\build\create_matrix.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\create_matrix.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +load_image_1.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage1(void)" (?loadImage1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_1.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_1.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_1.vcxproj] +load_image_2.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage2(void)" (?loadImage2@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_2.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_2.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_2.vcxproj] +load_image_3.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage3(void)" (?loadImage3@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_3.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_3.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_3.vcxproj] +``` + +### Attemp 6 + +Try this: + +```cmake +ExternalProject_Add( + opencv_external + PREFIX ${CMAKE_BINARY_DIR}/third-party/opencv4.10 + SOURCE_DIR ${CMAKE_SOURCE_DIR}/third-party/opencv4.10 + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_DIR}/opencv4.10 + # -DCMAKE_BUILD_TYPE=Release + # -DCMAKE_CONFIGURATION_TYPES=Release # If this is not set it will attempt to build other configurations on Windows and cause and error + -DBUILD_SHARED_LIBS=ON + -DBUILD_TEST=OFF + -DBUILD_EXAMPLES=OFF + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release +) +``` + + +Commands: + +```bash +cmake -S . -B build +cmake --build build --config Debug +cd 02-opencv-library +cmake -S . -B build # We passed this point +cmake --build build # ERROR here +``` + +Output: + +```powershell +PS C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library> cmake --build build +MSBuild version 17.5.1+f6fdcf537 for .NET Framework + + Checking Build System + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + change_pixels.cpp +change_pixels.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Cam +era\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl changePixels(void)" (?cha +ngePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcon +tainer\02-opencv-library\build\change_pixels.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\change_pixels.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + create_matrix.cpp +create_matrix.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_C +amera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl createMatrix1(void)" (?cr +eateMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devc +ontainer\02-opencv-library\build\create_matrix.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\create_matrix.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_1.cpp +load_image_1.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage1(void)" (?loadImage1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_1.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_1.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_1.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_2.cpp +load_image_2.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage2(void)" (?loadImage2@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_2.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_2.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_2.vcxproj] + Building Custom Rule C:/Users/wambe/Workspace/Udacity/SensorFusion/03_Camera/sfnd-camera-devcontainer/02-opencv-library/CMakeLists.txt + load_image_3.cpp +load_image_3.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage3(void)" (?loadImage3@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_3.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_3.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_3.vcxproj] +``` + +```bash +cmake --build build --config Debug # ERROR here +``` + +Error too: + + +```powershell +PS C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library> cmake --build build --config Debug +MSBuild version 17.5.1+f6fdcf537 for .NET Framework + +change_pixels.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Cam +era\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl changePixels(void)" (?cha +ngePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcon +tainer\02-opencv-library\build\change_pixels.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\change_pixels.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\change_pixels.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_C +amera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl createMatrix1(void)" (?cr +eateMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devc +ontainer\02-opencv-library\build\create_matrix.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\create_matrix.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\create_matrix.vcxproj] +load_image_1.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage1(void)" (?loadImage1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_1.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_1.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_1.vcxproj] +load_image_2.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage2(void)" (?loadImage2@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_2.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_2.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_2.vcxproj] +load_image_3.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage3(void)" (?loadImage3@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\02-opencv-library\build\load_image_3.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\Debug\load_image_3.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\02-opencv-library\build\load_image_3.vcxproj] +``` + +Commands: + +``` +cd .. +cmake --build build --config Release +cd 02-opencv-library +cmake --build build --config Release +``` + +SUCCESS!!! + +### Attemp 7 + +From the parent dir + +```bash +cmake -S . -B build +cmake --build build --config Release +``` + +SUCESS!!! + +```bash +cmake --build build --config Debug +``` + +ERRORS: + +``` powershell +PS C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer> cmake --build build --config Debug +MSBuild version 17.5.1+f6fdcf537 for .NET Framework + +change_pixels.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Cam +era\sfnd-camera-devcontainer\build\02-opencv-library\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl changePixels(void)" (?cha +ngePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\change_pixels.vcxproj] +change_pixels.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl changePixels(void)" (?changePixels@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcon +tainer\build\02-opencv-library\change_pixels.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\Debug\change_pixels.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\change_pixels.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "class cv::debug_build_guard::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAAEBV_Inpu +tOutputArray@debug_build_guard@1@XZ) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_C +amera\sfnd-camera-devcontainer\build\02-opencv-library\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "public: class cv::Mat & __cdecl cv::Mat::setTo(class cv::debug_build_guard::_InputArray const &,class cv::d +ebug_build_guard::_InputArray const &)" (?setTo@Mat@cv@@QEAAAEAV12@AEBV_InputArray@debug_build_guard@2@0@Z) referenced in function "void __cdecl createMatrix1(void)" (?cr +eateMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\create_matrix.vcxproj] +create_matrix.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_bui +ld_guard@1@@Z) referenced in function "void __cdecl createMatrix1(void)" (?createMatrix1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devc +ontainer\build\02-opencv-library\create_matrix.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\Debug\create_matrix.exe : fatal error LNK1120: 3 unresolved exter +nals [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\create_matrix.vcxproj] +load_image_1.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage1(void)" (?loadImage1@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\build\02-opencv-library\load_image_1.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\Debug\load_image_1.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\load_image_1.vcxproj] +load_image_2.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage2(void)" (?loadImage2@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\build\02-opencv-library\load_image_2.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\Debug\load_image_2.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\load_image_2.vcxproj] +load_image_3.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_buil +d_guard@1@@Z) referenced in function "void __cdecl loadImage3(void)" (?loadImage3@@YAXXZ) [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontaine +r\build\02-opencv-library\load_image_3.vcxproj] +C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\Debug\load_image_3.exe : fatal error LNK1120: 1 unresolved extern +als [C:\Users\wambe\Workspace\Udacity\SensorFusion\03_Camera\sfnd-camera-devcontainer\build\02-opencv-library\load_image_3.vcxproj] +``` + +### Attempt 8 - Winner Winner Chiken Dinner!!! (This need to have the install first no subderectories allowed) + +ExternalProject_Add( + opencv_external + PREFIX ${CMAKE_BINARY_DIR}/third-party/opencv4.10 + SOURCE_DIR ${CMAKE_SOURCE_DIR}/third-party/opencv4.10 + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_DIR}/opencv4.10 + # NOTE: If this is not configured then Release it's used by default and sub projects cannot be build in Debug Mode + -DCMAKE_CONFIGURATION_TYPES=Debug;Release + -DBUILD_SHARED_LIBS=ON + -DBUILD_TEST=OFF + -DBUILD_EXAMPLES=OFF + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $ + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config $ +) + +Commands + +``` +cmake -S . -B build +cmake --build build --config Debug +cmake --build build --config Release +``` + + +### Attempt 9 - Winner Winner Chiken Dinner!!! (This need to have the install first no subderectories allowed) + +``` +cmake -S . -B build +cmake --build build --config Release +``` + +## sub_directory() + +After several attemtps I was not able to use ExternalProject on Release and subprojects on Debug so we will try now with `sub_directory()` + + +### Attemp 1: + +```bash +cd third-party/opencv4.10 +cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON +cmake --build build --config Release +cmake --build build --target install --config Release # can we skip? -> Yes, we just use build dir not install dir as OpenCV_DIR +``` + +We can use this if we want to skip the installation: + +```cmake +set(OpenCV_DIR "${CMAKE_SOURCE_DIR}/../third-party/opencv4.10/build/") # THIS WORKS without installation!!! +``` + +If we want to skip the install we can also do manual management of the libraries used which could be cumbersome and require mantainance, this might be ideal for production environments though. + + +Everything got generated at + +```bash +03_Camera\sfnd-camera-devcontainer\third-party\opencv4.10\build\bin\Release # Also debug if generated +03_Camera\sfnd-camera-devcontainer\third-party\opencv4.10\build\lib\Release # Also debug if geberated +``` + +After install it copies that content to, it also depends on the configuration used, libraries get overwritten based on the command, i.e. if Release it's installed and then Debug the previous intallation will get overwritten and vicerversa. + +```bash +cmake --build build --config Debug --target install +cmake --build build --config Release --target install +``` + +```bash +03_Camera\sfnd-camera-devcontainer\third-party\opencv4.10\build\install\x64\vc17\bin +03_Camera\sfnd-camera-devcontainer\third-party\opencv4.10\build\install\x64\vc17\ib +``` + + + diff --git a/docs/doc.md b/docs/doc.md new file mode 100644 index 00000000..bf64ffcf --- /dev/null +++ b/docs/doc.md @@ -0,0 +1,251 @@ +# README + +**This repository provides a structured approach to building and running C++ projects that depend on OpenCV.** Whether you are using a globally installed version of OpenCV or integrating a local version via a submodule, this guide will help you set up the environment, build the code, and ensure proper runtime configuration. + +## Table of Contents + +1. [Overview](#overview) +2. [Prerequisites](#prerequisites) +3. [Choosing Between Global and Local OpenCV](#choosing-between-global-and-local-opencv) +4. [Global OpenCV Integration](#global-opencv-integration) + - [Building All Projects](#building-all-projects-with-global-opencv) + - [Building a Single Project](#building-a-single-project-with-global-opencv) +5. [Local OpenCV Integration (Submodule)](#local-opencv-integration-submodule) + - [Initializing the Submodule](#initializing-the-submodule) + - [Building and Installing Local OpenCV](#building-and-installing-local-opencv) + - [Building All Projects with Local OpenCV](#building-all-projects-with-local-opencv) + - [Building a Single Project with Local OpenCV](#building-a-single-project-with-local-opencv) +6. [Environment Variables and PATH Setup](#environment-variables-and-path-setup) + - [PowerShell](#powershell) + - [CMD](#cmd) + - [Bash](#bash) +7. [Advanced Configuration Examples](#advanced-configuration-examples) +8. [Testing and Verification Scenarios](#testing-and-verification-scenarios) +9. [Troubleshooting](#troubleshooting) +10. [Additional Tips](#additional-tips) + +## Overview + +This repository hosts multiple C++ projects that demonstrate OpenCV usage. The build system is powered by CMake, allowing flexibility in how you integrate OpenCV: + +- **Global OpenCV:** Ideal if OpenCV is already installed on your system via package managers or installers. +- **Local OpenCV (Submodule):** Keeps projects self-contained, making them portable and consistent across machines and environments (e.g., CI servers, devcontainers). + +**Key Goals:** +- Provide a reproducible build environment. +- Allow quick switching between global and local OpenCV installations. +- Offer clear instructions for configuring environment variables and paths. + + +## Prerequisites + +- **CMake (3.10+ recommended)** +- **C++ Compiler:** MSVC on Windows or GCC/Clang on Linux. +- **Git:** For managing submodules when using local OpenCV. +- **OpenCV Installed Globally (Optional):** If you prefer using the system’s OpenCV. + + +## Choosing Between Global and Local OpenCV + +**Global installation** is simpler if your workstation already has OpenCV set up. Projects will just need to find it via `find_package(OpenCV REQUIRED)`. + +**Local installation** is recommended if: +- You need a specific OpenCV version not available globally. +- You want consistent builds across different environments (e.g., devcontainers, CI). +- You do not have administrative privileges to install system-wide dependencies. + +You can easily switch by adjusting `OpenCV_DIR` and `PATH`. + +--- + +## Global OpenCV Integration + +If OpenCV is globally installed, you can build all projects at once or individually with minimal configuration. + +### Building All Projects with Global OpenCV + +```bash +cd ../../ +cmake -S . -B build +cmake --build build --config Release +cmake --build build --config Debug +``` + +This top-level build command processes all subdirectories and projects in one go. + +### Building a Single Project with Global OpenCV + +If you only want to work on `01-playground`: + +```bash +cd 01-playground +cmake -S . -B build +cmake --build build --config Release +cmake --build build --config Debug +``` + +Ensure that `OpenCV_DIR` points to your global OpenCV installation directory (if needed) and that your `PATH` includes the OpenCV binary directory. If these are not set, `find_package(OpenCV REQUIRED)` will fail. + +--- + +## Local OpenCV Integration (Submodule) + +When global OpenCV isn’t available or desired, you can pull OpenCV as a submodule and build it from source. + +### Initializing the Submodule + +```bash +git submodule update --init --recursive +``` + +This downloads the OpenCV code into `third-party/opencv4.10`. + +### Building and Installing Local OpenCV + +```bash +cd third-party/opencv4.10 +cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../install +cmake --build build --config Release +cmake --build build --config Debug +cmake --build build --config Release --target INSTALL +cmake --build build --config Debug --target INSTALL +``` + +**Result:** OpenCV is installed to `third-party/opencv4.10/build/install`. You’ll point `OpenCV_DIR` to this directory. + +### Building All Projects with Local OpenCV + +```bash +cd ../../ +cmake -S . -B build +cmake --build build --config Release +cmake --build build --config Debug +``` + +### Building a Single Project with Local OpenCV + +For example, `01-playground`: + +```bash +cd 01-playground +cmake -S . -B build -DOpenCV_DIR="../third-party/opencv4.10/build/install" +cmake --build build --config Release +cmake --build build --config Debug +``` + +Adjust the relative path to `OpenCV_DIR` as needed based on your project’s location. + + +## Environment Variables and PATH Setup + +To run your executables, you must ensure that OpenCV’s binaries are discoverable at runtime. This often means adding the appropriate directories to your `PATH`. Overwriting `OpenCV_DIR` ensures CMake finds the correct OpenCV installation at configure time. + +**Note:** If multiple OpenCV versions coexist, ensure the correct path variables are set in your session before building or running. + +### PowerShell + +```powershell +$env:PATH = "${PWD}\third-party\opencv4.10\build\x64\vc17\bin;" + $env:PATH +``` + +### CMD + +```cmd +set "PATH=C:\full\path\to\third-party\opencv4.10\build\x64\vc17\bin;%PATH%" +``` + +### Bash + +```bash +PATH="/path/to/opencv/bin:$PATH" ./MyApp +``` + +## Advanced Configuration Examples + +- **Using a local OpenCV in a nested project structure:** + + ```bash + cmake -S . -B build -DOpenCV_DIR="../../third-party/opencv4.10/build/install" + cmake --build build + ``` + +- **Overwriting a global installation:** + + Set `OpenCV_DIR` to the local install path and adjust `PATH` to prioritize the local OpenCV `bin` directory over system paths. + + +## Testing and Verification Scenarios + +These tests were performed to validate various configurations. + +### TEST 1: All Projects with Global OpenCV + +```powershell +cmake -S . -B build +cmake --build build +.\build\02-opencv-library\Debug\create_matrix.exe +``` + +**Verify:** +```powershell +# Check OpenCV_DIR in environment and in CMakeCache.txt +echo ${env:OpenCV_DIR} +Get-Content .\build\CMakeCache.txt | Select-String -Pattern OpenCV_DIR + +# Check PATH includes OpenCV bin +echo ${env:PATH} | Select-String opencv +``` + +### TEST 2: All Projects with Local OpenCV + +```powershell +cmake -S . -B build -DOpenCV_DIR="third-party/opencv4.10/build/install" +cmake --build build +.\build\02-opencv-library\Debug\create_matrix.exe +``` + +**Verify:** Same checks as TEST 1, ensuring the `PATH` and `OpenCV_DIR` point to the local install. + +### TEST 3: Single Project with Global OpenCV + +```powershell +cd 01-playground +cmake -S . -B build +cmake --build build +.\build\Debug\create_matrix.exe +``` + +### TEST 4: Single Project with Local OpenCV + +```powershell +cd 01-playground +cmake -S . -B build -DOpenCV_DIR="../third-party/opencv4.10/build/install" +cmake --build build +.\build\Debug\create_matrix.exe +``` + +### TEST 5: Tests in a Devcontainer + +```bash +cmake -S . -B build +cmake --build build +# Run executables as normal +``` + +--- + +## Troubleshooting + +- **CMake can’t find OpenCV:** + Double-check `OpenCV_DIR` in `CMakeCache.txt` and ensure it’s set to the correct path. If not set, specify it manually with `-DOpenCV_DIR=...`. + +- **Executable fails to run due to missing DLLs (Windows) or `.so` files (Linux):** + Ensure that the OpenCV `bin` directory is included in your `PATH`. For local builds, updating `PATH` might be required each session. + +- **Multiple OpenCV versions conflict:** + Verify that `OpenCV_DIR` and `PATH` do not point to multiple installations simultaneously. Stick to one strategy (global or local) per build. + +- **Permission issues (Linux):** + If building locally, ensure you have write permissions in `third-party/opencv4.10/build/install`. + + diff --git a/third-party/opencv4.10 b/third-party/opencv4.10 new file mode 160000 index 00000000..71d3237a --- /dev/null +++ b/third-party/opencv4.10 @@ -0,0 +1 @@ +Subproject commit 71d3237a093b60a27601c20e9ee6c3e52154e8b1