Help updating 10 lines of deprecated OpenCV code in C++ [closed]
I need help updating 10 deprecated (OpenCV 3.2.0) lines of code found in https://github.com/yirgagithub/Cat-and-Dog-SVM-classifier (their last commit was on Mar 1, 2017) to work with OpenCV 4 on Ubuntu 20.04 LTS, because this is one of the few GitHub projects that uses C++ (NOT Python) to do image classification (in this case distinguising pictures of dogs and cats). I am taking a Udacity C++ online nanodegree courseand for their capstone project they suggest either making a computer game or creating an AI. I have decided to create an image classifier AI starting from https://github.com/yirgagithub/Cat-an... because that is the closest to what I might do when I get a job.
I understand that there are OpenCV courses (https://opencv.org/courses/) that if I spent weeks or months on I might figure this out on my own, but I have already taken several R Studio and Python (Spyder) AI online courses (that did not use OpenCV they used TensorFlow, etc.) so I do not want to spend time on more. I looked for C++ TensorFlow GitHub image classifier projects and that is not promising.
Below is my Fork of https://github.com/yirgagithub/Cat-and-Dog-SVM-classifier. The fork has the settings.json and launch.json in the .vscode directory and I updated some deprecated #include to their new locations in OpenCV 4. I ran cmake (below) and got stuck (errors) on the 12 deprecated elements:
cmake ..
cmake --build . --config Release
My Fork: https://github.com/ProfHariSeldon/CppND-Capstone-Hello-World
You can skip the Install Instructions and just look at DEPRICIATED: to see the code I need help with. I have confirmed that Visual Studio Code recognizes the OpenCV #include (I added that path "/home/tlroot/installation/OpenCV-master/include/opencv4/" to settings.json) and that cmake finds the OpenCV files too (I added that path "/home/tlroot/installation/OpenCV-master/" to CMakeLists.txt). I also don't really understand my CMakeLists.txt this is my first time building one from scratch. I got it working but if you have advice please let me know.
Install instructions
How to upgrade to Ubuntu 20.04 LTS sudo do-release-upgrade -d -f DistUpgradeViewGtk3
How to Install OpenCV 4 on Ubuntu Instructions here: https://www.learnopencv.com/install-opencv-4-on-ubuntu-18-04/
building from Source in my home directory I guess that's OK
$ cd /home/tlroot
$ sudo chmod +x ./installOpenCV-4-on-Ubuntu-18-04.sh
$ sudo bash installOpenCV-4-on-Ubuntu-18-04.sh
$ cd /home/tlroot/installation
$ sudo ldconfig
$ cd /home/tlroot/C++/Capstone
$ git clone https://github.com/yirgagithub/Cat-an...
The CMakeLists.txt file to use
# see CMake Lists.txt file in /home/tlroot/Documents/C++/OOP/Project/CppND-System-Monitor
# https://www.learnopencv.com/install-o...
cmake_minimum_required(VERSION 3.1)
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
SET(OpenCV_DIR /home/tlroot/installation/OpenCV-master/include/opencv4/)
# https://stackoverflow.com/questions/5...
find_package( OpenCV REQUIRED PATHS "/home/tlroot/installation/OpenCV-master/")
project(classifier)
file(GLOB SOURCES "dictionary/*.cpp")
add_executable(classifier ${SOURCES})