필터 지우기
필터 지우기

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

조회 수: 61 (최근 30일)
Anas
Anas 2023년 2월 11일
편집: Shiven Naidoo 2024년 5월 18일
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
Shiven Naidoo
Shiven Naidoo 2024년 5월 18일
편집: Shiven Naidoo 2024년 5월 18일
it's okay. I figured it out. I was able to stream the video on matlab.

댓글을 달려면 로그인하십시오.

답변 (2개)

Guillaume Baptist
Guillaume Baptist 2023년 5월 31일
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
Jonathan Gadiel Ramírez Martínez
Guillaume, you are the man!!! This worked for me, thanks a lot!

댓글을 달려면 로그인하십시오.


Harshit Saini
Harshit Saini 2023년 2월 15일
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
Anas
Anas 2023년 2월 17일
Still getting the same problem that it cannot connect to the IP camera stream URL
MathWorks MATLAB Hardware Team
MathWorks MATLAB Hardware Team 2023년 3월 8일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for IP Cameras에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by