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

5 次查看(过去 30 天)
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deploy to C++ Applications Using mwArray API (C++03) 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by