Error Microsoft C++ exception: mwException at memory location when passing CString to Matlab function

5 vues (au cours des 30 derniers jours)
I passed the path of file to the Matlab function, so it can read it. However, I got crashed again. Here what I did:
in Matlab:
function ImgProc(pathname)
mov=VideoReader(pathname);
nFrames=mov.NumberOfFrames;
for k=1:10
img=read(mov,k);
img=rgb2gray(img);
img = imresize(img, [64, 64]);
imshow(img);
code in C++: sFileName is CString which contains the video file path.
CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("Movie Files (*.avi;*.mpg;*.mp4)|*.avi;*.mpg;*.mp4||"), this);
CString sFileName = dlgFile.GetPathName();
bool a=mclInitializeApplication(NULL,0);
bool b= ImgProcInitialize();
mwArray out(sFileName);
ImgProc(out);
ImgProcTerminate();
mclTerminateApplication();
ImgProc function in C++:
ImgProc(const mwArray& pathname);
please help

Réponses (0)

Catégories

En savoir plus sur Deploy to C++ Applications Using mwArray API (C++03) dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by