/usr/bin/ld: /tmp/ccUfW2fQ.o: in function main': main.cpp:(.text+0x19e): undefined…
- User
/usr/bin/ld: /tmp/ccUfW2fQ.o: in function
main': main.cpp:(.text+0x19e): undefined reference tocv::ORB::create(int, float, int, int, int, int, cv::ORB::ScoreType, int, int)' /usr/bin/ld: main.cpp:(.text+0x453): undefined reference tocv::drawKeypoints(cv::_InputArray const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> > const&, cv::_InputOutputArray const&, cv::Scalar_<double> const&, cv::DrawMatchesFlags)' /usr/bin/ld: main.cpp:(.text+0x4e8): undefined reference tocv::drawKeypoints(cv::_InputArray const&, std::vector<cv::KeyPoint, std::allocatorcv::KeyPoint > const&, cv::InputOutputArray const&, cv::Scalar const&, cv::DrawMatchesFlags)' collect2: error: ld returned 1 exit status - Assistant
The errors you're encountering are linker errors, which occur when the linker is unable to resolve references to functions from libraries that your program uses. In this case, it seems like you're trying to use OpenCV functions, particularly related to the ORB feature detector and keypoint drawing, but the linker cannot find their implementations.
- User
Find problem:
Error occured: free(): invalid pointer Aborted (core dumped) in line: detector->detect(img1, keypoints1);
#include #include #include
#include <opencv2/opencv.hpp> #include <opencv2/imgcodecs.hpp> #include <opencv2/imgproc.hpp>
#include <opencv2/core/core.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/calib3d/calib3d.hpp> #include <opencv2/imgproc/imgproc.hpp>
// g++ -o main main.cpp -I/usr/include/opencv4 -L/usr/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_features2d
void show_image(const cv::Mat& img, const std::string& title); void save_image(const cv::Mat& img, const std::string& title);
int main() { cv::Mat img1 = cv::imread("image1_3c.png", cv::IMREAD_GRAYSCALE); cv::Mat img2 = cv::imread("image2_3c.png", cv::IMREAD_GRAYSCALE);
- Assistant