Webcam cannot be initialized properly.
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello guys,
I would like to use a machine vision camera (usb3.0 cable) to connect the raspberry 4B for a machine vision projects with simulink, the machine vision camera has its own SDK, which has been done in the raspberry pi. Then, I used the v4l2loopback to create a virtual webcam into the point-/dev/video0. After all, I tested it use the command- "r=raspi; w=webcam(r)" to test the connection between the machine vision camera on raspberry pi and matlab, but I got an error at below:
r=raspi
r =
raspi with properties:
DeviceAddress: '192.168.137.208'
Port: 18734
BoardName: 'Raspberry Pi 2 Model B'
AvailableLEDs: {'led0'}
AvailableDigitalPins: [4,5,6,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]
AvailableSPIChannels: {'CE0','CE1'}
AvailableI2CBuses: {'i2c-1'}
AvailableWebcams: {'HT VirtualCam (platform:v4l2loopback-000)'}
I2CBusSpeed: 100000
AvailableCANInterfaces: {}
Supported peripherals
>> w=webcam(r)
Webcam cannot be initialized properly. Please check if the device HT VirtualCam (platform:v4l2loopback-000) is available and free to use.
Could someone can help me about how to make a non-stardard USB camera to be detected by matlab?
Thank you very much!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2 commentaires
Umar
le 5 Jan 2025
Hi @Chen,
Please click the link below to help resolve your issue.
Contact MathWorks and Use the webcamSupport Function
Hope this helps.
Réponse acceptée
Gayathri
le 6 Jan 2025
From the error it seems like the camera is being used in some process and hence it was not able to create a connection in MATLAB.
To check if any of the process is using the webcam (outside the MATLAB), please follow the below steps.
- Please check if any application is using the webcam by using "$ top" command in the pi terminal window.
- Please check if any of the cron scheduler is using the webcam, by executing "$ crontab -e" and see if there are custom shell scripts or an application is running in timely basis.
- If none of the above steps doesnot work we can reboot the Rasberry Pi using "$ sudo reboot" and confirm "$ fswebcam" works in the pi terminal and then go to MATLAB to create the webcam object.
- If rebooting doesnot help, please follow the hardware setup process in MATLAB-> Addons-> Manage Addons->click on gear icon in Raspberry Pi support package and follow the setup process.
I hope this will resolve the issue! If you encounter any further problems, please feel free to reach out.
3 commentaires
Gayathri
le 6 Jan 2025
Did you try following the last step
- If rebooting doesnot help, please follow the hardware setup process in MATLAB-> Addons-> Manage Addons->click on gear icon in Raspberry Pi support package and follow the setup process.
Did this not work?
Also, try reinstalling the image on Raspberry Pi by choosing "Setup hardware with MathWorks Raspbian image" after executing following command in MATLAB.
w = matlab.hwmgr.internal.hwsetup.register.RaspberryPiWorkflow;
w.launch
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Raspberry Pi Hardware 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!