Я намерен использовать краткий дескриптор.Но я получаю эту неопределенную ошибку ссылки.Там нет проблем с созданием кода.Но компоновщик выдает ошибку.Пожалуйста, дайте мне знать, что я пропустил.Заранее спасибо.
Вот код
#include <iostream>
#include <cmath>
#include "opencv2/opencv.hpp"
#include "opencv2/xfeatures2d.hpp"
#include "harris_corner.h"
using namespace std;
class KeypointDescriptor {
public:
KeypointDescriptor();
virtual ~KeypointDescriptor() {}
void generate_keypoints(HarrisCorner&, cv::Mat&);
void compute_descriptor(HarrisCorner&, cv::Mat&);
cv::Ptr<cv::xfeatures2d::BriefDescriptorExtractor> desc_extr = cv::xfeatures2d::BriefDescriptorExtractor::create();
cv::Mat descriptors;
vector<cv::KeyPoint> kp;
};
CMakeLists.txt выглядит следующим образом
cmake_minimum_required(VERSION 3.5)
project(Harris_Corner_Detector_fromScratch)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Debug)
ENDIF()
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/build/cmake)
find_package(OpenCV REQUIRED)
add_compile_options(-std=c++11)
include_directories(include
${PROJECT_SOURCE_DIR}/
${PROJECT_SOURCE_DIR}/include/
${OpenCV_INCLUDE_DIRS}
)
add_library(HarrisCorner SHARED src/source_code/harris_corner.cpp)
add_library(KeypointDescriptor SHARED src/source_code/keypoint_descriptor.cpp)
add_executable(find_corner src/find_corner.cpp)
target_link_libraries(find_corner ${OpenCV_LIBS}
HarrisCorner)
add_executable(stitch_image src/stitch_image.cpp)
target_link_libraries(stitch_image ${OpenCV_LIBS}
HarrisCorner
KeypointDescriptor)
Вывод выглядит следующим образом
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tyagaraja/WPI/ARN/HW/Week10/Harris_Corner_Detector_fromScratch/build
[ 25%] Built target HarrisCorner
[ 50%] Built target KeypointDescriptor
[ 62%] Linking CXX executable stitch_image
libKeypointDescriptor.so: undefined reference to `cv::xfeatures2d::BriefDescriptorExtractor::create(int, bool)'
collect2: error: ld returned 1 exit status
CMakeFiles/stitch_image.dir/build.make:141: recipe for target 'stitch_image' failed
make[2]: *** [stitch_image] Error 1
CMakeFiles/Makefile2:105: recipe for target 'CMakeFiles/stitch_image.dir/all' failed
make[1]: *** [CMakeFiles/stitch_image.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Я использую OpenCV, который поставляется по умолчанию с ROS Kinetic