mex C++ use opencv library in Matlab 2020b

1 回表示 (過去 30 日間)
asmaa atalaa
asmaa atalaa 2022 年 12 月 18 日
回答済み: Ujwal Durgam 2023 年 1 月 30 日
I have amatlab code downloaded from the internet, this code has .cpp function and need opencv library.
I installed opencv 4.6.0, visual studio 2017, and installed opencvinterface.mlpkginstall toolbox, and added the path of opencv2 on matlab
but i still hav this error
mexOpenCV Keypoint_Detector.cpp
Building with 'Microsoft Visual C++ 2017'.
Error using mexOpenCV (line 135)
Keypoint_Detector.cpp
E:\New codes\IterativeCMFD-master\Functions\Keypoint_Detector.cpp(3):
fatal error C1083: Cannot open include file:
'\opencv2\highgui\highgui.hpp': No such file or directory
mex Keypoint_Detector.cpp
Building with 'Microsoft Visual C++ 2017'.
Error using mex
Keypoint_Detector.cpp
E:\New
codes\IterativeCMFD-master\Functions\Keypoint_Detector.cpp(2):
fatal error C1083: Cannot open include file:
'opencv2\core\core.hpp': No such file or directory
can anyone helping me solving this error?

回答 (1 件)

Ujwal Durgam
Ujwal Durgam 2023 年 1 月 30 日
mexOpenCV does not include the highgui module. Do not include highgui, if you want to use mexOpenCV.
However your code does not use this module, try to comment out the line 2.
Try using OpenCV Support - MATLAB & Simulink (mathworks.com) Mex Interface support for converting opencv data type to MATLAB datatype and display images in MATLAB.
If you want to use you installed opencv, you can use mex Keypoint_Detector.cpp.
However, you need to specify the Path to the OpenCV include files path and Libs path using -I and -L and link library using -l
example: mex Keypoint_Detector.cpp. -I/usr/local/include -L/us/local/lib -lopencv_world

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by