How can I use the IMREAD function with a URL that requires basic authentication in MATLAB 2014a??? (not the old matlab)
4 ビュー (過去 30 日間)
古いコメントを表示
I want to access ip-camera images using imread , but due to authentication, it is unaccessable. so please help.
0 件のコメント
回答 (1 件)
Cairo L. Nascimento Jr.
2015 年 3 月 7 日
編集済み: Cairo L. Nascimento Jr.
2015 年 3 月 7 日
I have tested the following solution in MATLAB R2013a and R2014b. I guess it should work in the MATLAB releases after R2013a.
1) For your specific IP camera model, find the HTTP/CGI command to grab the current camera image (snapshot) with basic authentication turned OFF.
Each camera manufacturer use a different command. You may have to search the manufacturer's website or use Google to find this information.
Some examples:
AXIS: http://{ip_address}:{port}/axis-cgi/jpg/image.cgi
LINKSYS: http://{ip_address}:{port}/img/snapshot.cgi
TRENDnet: http://{ip_address}:{port}/cgi/jpg/image.cgi
FOSCAM: http://{ip_address}:{port}/snapshot.cgi
Using your favorite web browser, acess your IP camera, turn authentication off and test the CGI command to get a snapshot of the camera. Then turn authentication on again.
2) In MATLAB:
a) firstly define the correct values for the variables: url, img_file, username, password. For instance:
% URL to get a camera snapshot
url='http://192.168.0.50/cgi/jpg/image.cgi';
img_file='image_cam.jpg'; % temporary file used to store the camera image
user='cam_user'; % username and password used to perform authentication
pass='cam_password';
b) execute the following MATLAB commands:
% grab the camera image and store it in a local temporary file
urlwrite(url,img_file,'Authentication','Basic','Username',user,'Password',pass);
% show the camera image and delete the local temporary file
imshow(imread(img_file));
delete(img_file);
I hope this info is useful.
ITA, Brazil
0 件のコメント
参考
カテゴリ
Help Center および File 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!