필터 지우기
필터 지우기

Can I get video stream from a tcpip port (ArDrone) to a Matlab figure?

조회 수: 5 (최근 30일)
Mario Rubio Gómez
Mario Rubio Gómez 2015년 6월 1일
댓글: José Guilherme Tucci 2017년 8월 16일
Helllo there.
I am trying to obtain video from an IP webcam in particular that HD camera on ARdrone parrot 2.0, I can get the video stream either with MPEG4.2 soft encoder or with H264-like codec or with MJPEG-like codec and is sent by a tcpip port by the drone.
The point is that, I have already been able to display this video stream on ffplay (external program to Matlab) using win7, but I would like to save video in a variable on Matlab in order to use image proccesing with it and control the drone depending on what "it's seeing".
I have already looked up for this matter and have not found anything illuminating. So I will be very grateful if any of you know how to get this image straight from the tcpip port or even from ffplay program.
Thank you
  댓글 수: 5
Rafael Alberto Torres Ovando
Rafael Alberto Torres Ovando 2016년 7월 11일
Mario Hello , I'm interested in the code that could video Get the AR Drone
José Guilherme Tucci
José Guilherme Tucci 2017년 8월 16일
Hey Mario, I would like to get this code too. Thanks!

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

답변 (4개)

Walter Roberson
Walter Roberson 2015년 6월 2일
There is a possibility that the situation has changed in the last two releases, but if not:
In R2014a and earlier (and perhaps it is still the case), there is no built-in facility for decoding streaming video, other than whatever can be handled by the GigE Vision Standard. For winvideo, whether directly connected cards or USB, the acquisition is frame by frame, complete frames. IP cameras other than perhaps GigE Vision compliant are handled by fetching individual frames, not by streaming video.
The Computer Vision toolkit does support H.264, but at least up to R2014a, only from files, not streaming from a device.
The only option I am aware of at the moment (other than whatever GigE Vision can handle) is that on MS Windows you can get programs that decode streaming video and which have ActiveX / Component Object (COM) interfaces that permit the output to be accessed as frames. I don't know if any of those offer a virtual Winvideo to make it even easier.
  댓글 수: 1
Mario Rubio Gómez
Mario Rubio Gómez 2015년 6월 2일
Thank you for taking your time and replying.
The problem with winvideo is that the ArDrone camera is not supported so, it is not recognised.
What you say at the end would be a great idea, but I do not know which program will make this.
See, I have installed the ffmpeg toolbox and I think using some functions of this toolbox could let me reach a right solution. Since I already play video through ffplay (ffmpeg player) using this code:
>>ffplay_command=sprintf('ffplay -window_title Video_AR_Drone_2.0 -framedrop -infbuf -f h264 -i http://192.168.1.1:5555 -framerate %d',drone.video_frame_rate);
>>system(ffplay_command);
I think that could exist a chance to get video stream from ip, pass it through ffmpeg (wheter using ffmpeg toolbox or just ffmpeg.exe as done here with ffplay), decode this video and take this decoded video or frames of the video back to a variable on Matlab so that I can process those images.
It would be helpful if any of you can help me with the code lines needed for ffmpeg to perform what it is said. Or any other option will be taken in account as well.
Thank you again.

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


Pablo Lara
Pablo Lara 2015년 7월 13일
I have been dealing with the same problem.
The solution I came with is to use ffmpeg to obtain images instead of the video stream. Basically, there are images continually being saved in a specified folder and, with Matlab, you can read and show them (it will be the same as if you were streaming) or process them. You will get rid of the lag that the stream has and you can increase the fps.
  댓글 수: 1
Felipe Martins
Felipe Martins 2015년 9월 15일
Hello, all.
I am also trying to do get the AR.Drone video into MATLAB. After trying several possibilities, it seems that Pablo's suggestion is the best option.
@Pablo, you mentioned that you got rid of the lag and could increase the fps rate. Could you share an example of your code, please?
Thanks a lot!

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


Florian Enner
Florian Enner 2016년 5월 14일
편집: Florian Enner 2016년 5월 14일
I've just uploaded a submission that supports streaming h264 (among other formats) from ip cameras. It doesn't require any toolboxes and should work with any recent (>2009a) version of MATLAB.
% Connect to stream
cam = HebiCam('<address>');
% Continously display latest image
figure();
fig = imshow(getsnapshot(cam));
while true
set(fig, 'CData', getsnapshot(cam));
drawnow;
end
You can get it through File Exchange or Github
  댓글 수: 2
David
David 2017년 1월 5일

Hi!

I am thinking about buying this one to work on it,

Do you think our script will detect that camara too?

http://craftmodel.com/drones-de-iniciacion/2066-drone-predator-sw-fpv-wifi-control-de-altura.html

Thanks in advance!

David
David 2017년 1월 5일
Hi!
I am thinking about buying this one to work on it, "DRONE PREDATOR SW FPV WIFI "
Do you think our script will detect that camara too?
Thanks in advance!!!
David

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


Grant
Grant 2015년 6월 2일
You can try the ipcam function in 15a. This may work with the MJPEG ARdrone stream.
  댓글 수: 3
Grant
Grant 2015년 6월 4일
Mario,
The size looks suspicious, because it is empty in 2 dimensions. Are you able to view the video stream using VLC player, Firefox, or something similar? Is the URL correct?
Also, you may want to contact MathWorks technical support about the hard crash you received. This may indicate a problem with the support package installation.
Manisha
Manisha 2015년 7월 31일
Hi Mario,
Is the stream provided by you a Motion JPEG stream. ipcam currently only supports Motion JPEG stream. In any case it should not have generated the system error. Would it be possible for you to contact our technical support. We would like to understand the root cause of this behavior.
Thanks, Manisha

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

Community Treasure Hunt

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

Start Hunting!

Translated by