Add opencv script, modified macro, add opencv section into readme

Signed-off-by: Micaela Verucchi <micaela.verucchi@unimore.it>
This commit is contained in:
Micaela Verucchi
2020-04-06 17:25:53 +02:00
parent dfdeb8b36e
commit 674c61d280
6 changed files with 17 additions and 9 deletions
+2 -2
View File
@@ -91,7 +91,7 @@ bool CenternetDetection::init(const std::string& tensor_path, const int n_classe
checkCuda( cudaMallocHost(&target_coords, 4 * K *sizeof(float)) );
#ifdef OPENCV_CUDA
#ifdef OPENCV_CUDACONTRIB
checkCuda( cudaMalloc(&mean_d, 3 * sizeof(float)) );
checkCuda( cudaMalloc(&stddev_d, 3 * sizeof(float)) );
@@ -177,7 +177,7 @@ void CenternetDetection::preprocess(cv::Mat &frame)
// step_t = end_t;
}
sz_old = sz;
#ifdef OPENCV_CUDA
#ifdef OPENCV_CUDACONTRIB
cv::cuda::GpuMat im_Orig;
cv::cuda::GpuMat imageF1_d, imageF2_d;
+2 -2
View File
@@ -160,7 +160,7 @@ bool MobilenetDetection::init(const std::string& tensor_path, const int n_classe
generate_ssd_priors(specs, N_SSDSPEC);
#ifndef OPENCV_CUDA
#ifndef OPENCV_CUDACONTRIB
checkCuda(cudaMallocHost(&input, sizeof(dnnType) * netRT->input_dim.tot()));
#endif
checkCuda(cudaMalloc(&input_d, sizeof(dnnType) * netRT->input_dim.tot()));
@@ -209,7 +209,7 @@ bool MobilenetDetection::init(const std::string& tensor_path, const int n_classe
void MobilenetDetection::preprocess(cv::Mat &frame)
{
#ifdef OPENCV_CUDA
#ifdef OPENCV_CUDACONTRIB
//move original image on GPU
cv::cuda::GpuMat orig_img, frame_nomean;
orig_img = cv::cuda::GpuMat(frame);
+2 -2
View File
@@ -30,7 +30,7 @@ bool Yolo3Detection::init(const std::string& tensor_path, const int n_classes) {
}
dets = tk::dnn::Yolo::allocateDetections(tk::dnn::Yolo::MAX_DETECTIONS, classes);
#ifndef OPENCV_CUDA
#ifndef OPENCV_CUDACONTRIB
checkCuda(cudaMallocHost(&input, sizeof(dnnType)*netRT->input_dim.tot()));
#endif
checkCuda(cudaMalloc(&input_d, sizeof(dnnType)*netRT->input_dim.tot()));
@@ -50,7 +50,7 @@ bool Yolo3Detection::init(const std::string& tensor_path, const int n_classes) {
void Yolo3Detection::preprocess(cv::Mat &frame)
{
#ifdef OPENCV_CUDA
#ifdef OPENCV_CUDACONTRIB
cv::cuda::GpuMat orig_img, img_resized;
orig_img = cv::cuda::GpuMat(frame);
cv::cuda::resize(orig_img, img_resized, cv::Size(netRT->input_dim.w, netRT->input_dim.h));