Error using C++ code to access camera via mex.
2 ビュー (過去 30 日間)
古いコメントを表示
I am trying to get an image from a thorlab camera via matlab. I am using a code from github ( https://github.com/mdaddysman/Thorlabs-CMOS-USB-cameras-in-Matlab ) where I add the .h and .lib files needed and run it. I have run succesfully this code on my laptop on 2021a. On a different computer, I had 2020b and then (in the process of troubleshooting this), I updated to 2021b. In neither version, I can get the image reliably on the second computer.
To be specific, after I run the installation file provided to make the mex files from c++, or after I open MATLAB, I have a short window of time during which I can run the video function provided from github before it throws out one of two errors: "Failed to 1 FreezeVideo: r = 178" or "Failed to 2 FreezeVideo: r = 178". To clarify, I do get a live image but only for several seconds before it stops and throws out this error, which makes me think that something is running in the background generating some change and interfering with the code.
I tracked this to a c++ file which looks if the video is frozen. The code that throws the error seems to be in the mex originating from the cpp GetImage.cpp:
result = is_FreezeVideo(phCam,IS_WAIT);
if(result != IS_SUCCESS)
{
is_FreeImageMem(phCam,pImage,imgID);
mxFree(pImage);
is_ExitCamera(phCam);
sprintf(errbuffer,"Failed to 1 FreezeVideo: r = %i",result);
mexErrMsgTxt(errbuffer);
return;
}
and this occurs in the matlab side when I try to get an image with
image = GetImage(hCam,width,height);
The first thing I am trying to understand is why does it take some time between when the image collection is still viable and when the error is thrown.
Please, let me know if anyone has any advice on what may be creating this, how to debug it and get it operational on a different machine.
1 件のコメント
Gabriel Seymour
2023 年 7 月 18 日
Hello, please see my response to the open issue on the Github repo found here https://github.com/mdaddysman/Thorlabs-CMOS-USB-cameras-in-Matlab/issues/1. Fortunately, this is a simple fix and the code in the pull request should be ready to download and use.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で GenICam Interface についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!