when I add #include “opencv2/objdetect.hpp” , there is a wrong :“/usr/include/opencv2/objdetect/face.hpp:85:47: error: ‘CV_WRAP_FILE_PATH’ has not been declared
85 | CV_WRAP static Ptr create(CV_WRAP_FILE_PATH const String& model,
| ^~~~~~~~~~~~~~~~~
/usr/include/opencv2/objdetect/face.hpp:85:77: error: expected ‘,’ or ‘…’ before ‘&’ token
85 | CV_WRAP static Ptr create(CV_WRAP_FILE_PATH const String& model,
| ^
In file included from /usr/include/opencv2/objdetect.hpp:869,
from /home/zero/openCV/chip_phytium/with_opencv/include/cv_zone.h:5,
from /home/zero/openCV/chip_phytium/with_opencv/src/cv_zone_chapter2_3_4.cpp:1:
/usr/include/opencv2/objdetect/face.hpp:157:49: error: ‘CV_WRAP_FILE_PATH’ has not been declared
157 | CV_WRAP static Ptr create(CV_WRAP_FILE_PATH const String& model, CV_WRAP_FILE_PATH const String& config, int backend_id = 0, int target_id = 0);
| ^~~~~~~~~~~~~~~~~
/usr/include/opencv2/objdetect/face.hpp:157:79: error: expected ‘,’ or ‘…’ before ‘&’ token
157 | CV_WRAP static Ptr create(CV_WRAP_FILE_PATH const String& model, CV_WRAP_FILE_PATH const String& config, int backend_id = 0, int target_id = 0);
| ^”
so i check the file “cvdef.h” don`t find the definition ,it only have
#define CV_WRAP
#define CV_WRAP_AS(synonym)
#define CV_WRAP_MAPPABLE(mappable)
#define CV_WRAP_PHANTOM(phantom_header)
#define CV_WRAP_DEFAULT(val)
my codes as follows:
// main.cpp
#include <opencv2/core/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include “opencv2/objdetect.hpp”
void cv_zone_face_detection()
{
string path = “…/peripheral/cv_zone/Resources/test.png”;
Mat img = imread(path);
// CascadeClassifier face_cascade;
// face_cascade.load("../peripheral/cv_zone/Resources/haarcascade_frontalface_default.xml");
// if (face_cascade.empty()) {
// cout << "Cascade file not loaded" << endl;
// }
imshow("Image", img);
waitKey(0);
}
my CMakeLists.txt as follows:
// CMakeLists.txt
cmake_minimum_required(VERSION 3.16.3)
Project(opencv_SDK_phytium)
option(RUNNING_OPENCV “Build with OpenCV” ON)
if(DEFINED RUNNING_OPENCV)
if(RUNNING_OPENCV)
message(“Build with OpenCV”)
find_package(OpenCV REQUIRED)
# opencv 官方库文件
include_directories(${OpenCV_INCLUDE_DIRS})
# 自定义文件
include_directories(with_opencv/include)
aux_source_directory (with_opencv/src SRC_LIST)
else()
message(“Build without OpenCV”)
ADD_DEFINITIONS(-DCLOSE_OPENCV)
endif()
endif()
set(CMAKE_THREAD_LIBS_INIT “-lpthread”)
SET(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -pthread”)
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
include_directories(include)
aux_source_directory (src SRC_LIST)
add_executable(vedio_opencv main.cpp {SRC_LIST})
if(RUNNING_OPENCV)
target_link_libraries(vedio_opencv {OpenCV_LIBS})
endif()
I would appreciate it if you helped me~
[/quote]
my CMakeLists.txt as follows:
CMakeLists.txt
cmake_minimum_required(VERSION 3.16.3)
Project(opencv_SDK_phytium)
option(RUNNING_OPENCV “Build with OpenCV” ON)
if(DEFINED RUNNING_OPENCV)
if(RUNNING_OPENCV)
message(“Build with OpenCV”)
find_package(OpenCV REQUIRED)
# opencv 官方库文件
include_directories(${OpenCV_INCLUDE_DIRS})
# 自定义文件
include_directories(with_opencv/include)
aux_source_directory (with_opencv/src SRC_LIST)
else()
message(“Build without OpenCV”)
ADD_DEFINITIONS(-DCLOSE_OPENCV)
endif()
endif()
set(CMAKE_THREAD_LIBS_INIT “-lpthread”)
SET(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -pthread”)
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
include_directories(include)
aux_source_directory (src SRC_LIST)
add_executable(vedio_opencv main.cpp ${SRC_LIST})
if(RUNNING_OPENCV)
target_link_libraries(vedio_opencv ${OpenCV_LIBS})
endif()
I would appreciate it if you helped me~