To work with deep learning in our code, we have to import the corresponding headers:
#include <opencv2/dnn.hpp>#include <opencv2/imgproc.hpp>#include <opencv2/highgui.hpp>
After that, we will import the required namespaces:
using namespace cv;using namespace std;using namespace cv::dnn;
Now we are going to define the input image size and constant that we are going to use in our code:
const size_t inWidth = 300;const size_t inHeight = 300;const double inScaleFactor = 1.0;const Scalar meanVal(104.0, 177.0, 123.0);
In this example, we need a few parameters as input, such as the model configuration and pre-trained model, if we are going to process camera or video input. We also need the minimum confidence ...