フィルターのクリア

What should I do/change/add in my code so my source would be my IP Cam?

2 ビュー (過去 30 日間)
Erika
Erika 2014 年 1 月 16 日
コメント済み: Walter Roberson 2015 年 10 月 5 日
I have a code wherein my laptop camera would be the source of the video stream. It has a snapshot function once it runs, and the image captured will be saved in a specific folder.
However, I now want to use an IP cam as the source. The IP cam will be accessed through a router (an access point).
What should I add/change on my code and where should I place it (the additional code/change in the code)? The address of my IP cam is 192.168.0.101 at port 80.
I really hope somebody can help me :(
Here's the whole code by the way:
vid = videoinput('winvideo', 1, 'RGB24_640x480');
preview(vid);
pathname = 'C:\Users\Valued User\Documents\5th year, 2nd term\THESIS\imagesss';
if ~exist(pathname, 'dir')
mkdir(pathname);
end
for i=1
data= getsnapshot(vid);
pause(1);
imshow(data);
baseFileName = sprintf('ForDetection.jpg', 1);
fullFileName = fullfile(pathname, baseFileName);
imwrite(data,fullFileName);
end

回答 (2 件)

Haiko
Haiko 2014 年 1 月 16 日
編集済み: Walter Roberson 2014 年 1 月 16 日
When using an IP-cam it works a bit different. To read a single image something similar as the following line of code can be used, assuming the IP camera uses MJPEG (motion jpeg). In this code the user name is 'admin' and the user password is 'admin' aswell.
Image = imread('http://192.168.0.101/snapshot.cgi?user=admin&pwd=admin');
When multiple pictures are required use a while or for loop.
For i=1:100
Image(i) = imread('http://192.168.0.101/snapshot.cgi?user=admin&pwd=admin');
end
good luck
  3 件のコメント
Haiko
Haiko 2014 年 1 月 16 日
If you just need the one image, that would probably work. Note; part of the string 'snapshot.cgi?user=admin&pwd=admin' might be different, this depends a on your camera.
Walter Roberson
Walter Roberson 2014 年 1 月 16 日
You would replace most of the code, not just add that at the top.
data = imread('http://192.168.0.101/snapshot.cgi?user=admin&pwd=admin');
baseFileName = sprintf('ForDetection.jpg', 1);
fullFileName = fullfile(pathname, baseFileName);
imwrite(data, fullFileName);

サインインしてコメントする。


John Alric
John Alric 2014 年 1 月 18 日
I manged to get the feed from the IP Cam using this code
url = 'http://ce4563.myfoscam.org:88/snapshot.cgi?user=guest&pwd=1234';
ss = imread(url);
FileNum = 1;
fh = image(ss);
while(1)
pause(1)
ss = imread(url);
set(fh,'CData',ss);
drawnow;
FileNum = FileNum + 1;
end
But the frame rate is slower than the browser stream is there anyway to speed up the video?
  2 件のコメント
Tiwa Romuald
Tiwa Romuald 2015 年 10 月 5 日
hi escuse me please how to have stream video from my ipcam to matlab thank you
Walter Roberson
Walter Roberson 2015 年 10 月 5 日
The exact details depend upon your manufacturer and model of camera.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB 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