Effacer les filtres
Effacer les filtres

How to connect my esp32 cam to Matlab gui and stream video

70 vues (au cours des 30 derniers jours)
Anas
Anas le 11 Fév 2023
Modifié(e) : Shiven Naidoo le 18 Mai 2024
How to connect my esp32 cam to Matlab gui and stream video, I have the IP address but the problem is that it doesn't have the /cam.mjpeg after it and I keep getting an error
  1 commentaire
Shiven Naidoo
Shiven Naidoo le 18 Mai 2024
Modifié(e) : Shiven Naidoo le 18 Mai 2024
it's okay. I figured it out. I was able to stream the video on matlab.

Connectez-vous pour commenter.

Réponses (2)

Guillaume Baptist
Guillaume Baptist le 31 Mai 2023
To get the stream video from matlab, I have installed the MATLAB Support Package for IP Cameras.
On the esp32-CAM side, I have uploaded the example arduino sketch called CameraWebServer.ino . This provides me with an IP adress to get the stream in my browser i.e i got the following message in the serial monitor: "Camera Ready! Use 'http://192.168.1.24' to connect"
Copy/pasting this adress in my browser (chrome) allows me to get a beautiful user interface to change differents parameters and it works well. Now, the problem in matlab is that just running the following line doesn't work :
cam = ipcam('http://192.168.1.24') ; % DOES NOT WORK FOR ME
It generates the following error.
Cannot connect to the IP Camera Stream URL. Make sure the URL is correct and authentication is provided if needed.
There is 2 main points to solve this problem:
  • one needs to use port 81 and not 80 which is the streaming port
  • one has to add "stream" at the end of the command
cam = ipcam('http://192.168.1.24:81/stream'); % WORK FOR ME
Then, it works for me and I get my cam object created and i can see the preview by doing:
preview(cam)
I also could get a snapshot with the following code:
clear all;
cam = ipcam('http://192.168.1.24:81/stream');
img = snapshot(cam);
imshow(img)
And I get my picture!
Hope it helps!
Cheers.
  2 commentaires
Jonathan Gadiel Ramírez Martínez
Guillaume, you are the man!!! This worked for me, thanks a lot!
Simphiwe Lindiwe
Simphiwe Lindiwe le 20 Oct 2023
thank you so much

Connectez-vous pour commenter.


Harshit Saini
Harshit Saini le 15 Fév 2023
To connect your ESP32 Cam to MATLAB GUI and stream video, you can use the “ipcam” function available in the Image Acquisition Toolbox. Here are the steps you can follow:
  • In MATLAB, create a new script and execute the following lines of code:
vid = ipcam('http://IP_ADDRESS:PORT_NUMBER');
preview(vid);
% Replace IP_ADDRESS and PORT_NUMBER with the actual IP address and port number of your ESP32 Cam. Make sure that your ESP32 Cam is connected to the same network as your computer running MATLAB.
  • Run the script. The “ipcam” function should connect to the ESP32 Cam and start streaming the video.
If you are getting an error because the IP address doesn't have the /cam.mjpeg after it, try adding that to the end of the IP address in the “ipcam” function. For example:
vid = ipcam('http://IP_ADDRESS:PORT_NUMBER/cam.mjpeg');
This should allow MATLAB to correctly connect to the ESP32 Cam and stream the video
  2 commentaires
Anas
Anas le 17 Fév 2023
Still getting the same problem that it cannot connect to the IP camera stream URL
MathWorks MATLAB Hardware Team
Hi Anas, Could you post the exact error message that you are getting here.
Also an IP camera connection issue mentioned here is now fixed in the latest MATLAB update. Update your MATLAB and IP camera support package to the latest versions and try out the fix, to see if it resolves the issue.

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB Support Package for IP Cameras 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