필터 지우기
필터 지우기

mex C++ use opencv library in Matlab 2020b

조회 수: 6 (최근 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