Unresolved externals when creating a mex function
8 ビュー (過去 30 日間)
古いコメントを表示
I am creating a simple mex function for the OpenCV imread() function. This will allow me to read freames from a camera stream.
I receive an error stating that I have two, unresolved externals as shown below:
error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::imread(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &,int)"
I am able to use the imread() functionality directly from Visual Studio in my Python and C++ scripts so there is no problem with my OpenCV download. In the code that I have pasted below, all functionallity with the cv::createBackgroundSubtractorMOG2() works perfectly. ie: when I compile the mex function with only that functionallity, it works fine.
Why is it that functionallity with the cv::createBackgroundSubtractorMOG2() works fine but when I add in the imread() function it gives me the errors.
This is my code:
#include "opencvmex.hpp"
using namespace cv;
static Ptr<BackgroundSubtractorMOG2> ptrBackgroundModel = cv::createBackgroundSubtractorMOG2();
// Static smart pointer to hold the loaded image
static Ptr<Mat> ptrImage = makePtr<Mat>();
// Function to load an image from a file
void loadImageFromFile(const std::string& filename) {
// Load the image from file
Mat image = cv::imread(filename);
// Assign the loaded image to the static smart pointer
*ptrImage = image;
}
2 件のコメント
James Tursa
2024 年 5 月 3 日
編集済み: James Tursa
2024 年 5 月 3 日
Why is the error message showing a imread() signature with four arguments but your example code imread() has only one argument? Are there other imread() calls in your code that have four arguments?
Are there multiple libraries you need to link with?
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!