Webcam Package Not Working

Hi everyone,
I am trying to use Matlab Support Package for USB Webcams on a PC with a fresh Windows 10 installation (nothing else installed besides Matlab R2023b). However I get the following error when I try to use a command from the package, such as webcamlist:
Invalid MEX-file 'C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\matlab\webcam\supportpackages\webcammex.mexw64': The specified module could not be found.
Do you have any idea why this may be occurring? I am not having such an issue on any other PC. Should I have some other packages installed?

 Accepted Answer

Hakan Caldag
Hakan Caldag on 27 Mar 2024
In case anyone experiences this problem in the future, a fresh Windows installation and using the specific Matlab version I developed the app solved the problem (probably it was the Windows installation that solved the issue.)

4 Comments

OK, but in your original question you said you already had a fresh Windows installation. And I don't think a new version of MATLAB would cause your webcam program that you developed in an earlier version to break, unless you were running a compiled, standalone version and not running the source code in the MATLAB development environment. Was that the case - you were running a standalone webcam executable program you had compiled? Because that could have caused the problem.
Since you didn't run r2023b, then what version was the"specific Matlab version I developed the app" in?
I had tried running the app both in the development environment and as a standalone executable (by the way, just realized that I didn't mention the app in the original question but it was related to running an app using webcam functions). I developed the app in R2023a. Besides, Matlab was giving me the error even if I tried using a simple command such as webcamlist in the command window (and that was my original question). So whatever the problem was, it was completely independent from the app.
Yes, this confirms my suspicions stated in my earlier post. If you have a standalone executable, then you can run that executable on the computer where you compiled it, as long as the release you compiled it with is still on that computer. So when you had 2023a, you could run it both in the development environment and as a standalone compiled executable. The reason it could run as a compiled executable is that you still had r2023a on that computer. If you didn't then you'd have to have the runtime library installed on the computer.
When you reinstalled Windows and then installed MATLAB R2023b (only) then the code necessary to run the standalone executable compiled in r2023a did not exist on that computer, so it could not run. The source code should have still been able to run in the MATLAB development environment though.
To get the r2023a executable to run on your computer which now has only r2023b on it, you'd have to install the run-time library for r2023a, which you can get here:
A command like webcamlist should work in the command window in any version of MATLAB so I'm not sure why it didn't run for you in R2023b. Perhaps it needed the webcam Add-on, like I mentioned in my answer below, but you said that you had installed it. I asked you to call tech support. Did you? If not, why not. If so, what did they say? Have you tried returning to the R2023b again and trying again? But now r2024a is out so you might as well try that version instead.
Well, you raised several points, so let me summarise the whole process below:
  • I developed the app in a separate PC with Matlab R2023a where it ran both as a standalone and within the development environment without any issues.
  • The issue arised when I tried running this app in another PC (the one with the fresh Windows install).
  • I had initially tried installing the runtime library for R2023a and running the app with that. It didn't work. I thought this to be because of the runtime environment not including the webcam package so I decided to go on with a complete installation of Matlab.
  • I installed R2023b and the webcam package. Tried the app within the app development environment. Didn't work.
  • Thought there might be an issue with the app or some kind of compatibility issue between R2023a and R2023b. Tried writing webcamlist on the command window to see if the webcam package works at all. Didn't work.
  • Asked here, you suggested asking to support. I asked and they only suggested a clean install of the support package. Didn't work.
  • Decided to reinstall Windows and install specifically Matlab R2023a. Installed webcam package again as well. Tried the app in the development environment. It worked.
So I have no idea what the issue was but you raise a good point about the runtime compiler version compatibility. Regardless, I solved my issue anyway so I don't need to iterate any further.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 7 Nov 2023
Did you install the webcam package from the Add-ons button on the tool ribbon?

6 Comments

Yes I did.
Image Analyst
Image Analyst on 7 Nov 2023
Edited: Image Analyst on 7 Nov 2023
Type this into the address field of File Explorer:
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\matlab\webcam\supportpackages
Does it go there to that folder? Or does it say no such folder? If so, is the file
'C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\matlab\webcam\supportpackages\webcammex.mexw64
in that folder? Or not? It seems to think it's not there.
The folders and files are all there. Might it be possible that Matlab cannot access to those somehow? I don't think there is any reason for that but...
I'd call tech support.
Sounds like an anti-virus is interfering.
No extra antivirus software is installed at all. Let's see what tech support will say.

Sign in to comment.

Categories

Products

Release

R2023b

Tags

Community Treasure Hunt

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

Start Hunting!