compile c++ code that uses openCV on Windows

조회 수: 4 (최근 30일)
MatlabUser
MatlabUser 2023년 2월 14일
댓글: MatlabUser 2023년 2월 14일
I am trying to run fileName.cpp code that includes opencv2 library
I have opencv installed on my system but I didn't know why when I use:
Mex fileName.cpp
I got this error:
Cannot open include file: 'opencv2/opencv.hpp': No such file or directory
it seems there is a problem in linking opencv library to Matlab so the mex file can find it? how can I do that for windows OS.
thank in advance ...

채택된 답변

Walter Roberson
Walter Roberson 2023년 2월 14일
mex does not know that it should link opencv2 if installed, and a lot of the time it would be a mistake to link it just because it is installed.
You should use the mex -I option to indicate the dictionary that contains opencv2, and the mex -L option to indicate the directory that contains the opencv2 DLLs
  댓글 수: 1
MatlabUser
MatlabUser 2023년 2월 14일
Thank you,
this is actually worked
from openCV folder: I used
>> mex -I'C:/Users/name/Downloads/opencv/build/include' -L'C:/Users/name/Downloads/opencv/build/x64/vc14/bin' fileName.cpp
and it worked
I also noticed that using
>>mexOpencv fileName.cpp
also worked...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by