Path: news.mathworks.com!not-for-mail
From: "Michele " <denber.nospam@mindspringNOSPAM.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Web cam access in Matlab
Date: Wed, 22 Aug 2007 00:24:08 +0000 (UTC)
Organization: Michele Denber (ID: 1-A7A3B)
Lines: 52
Message-ID: <fafvn8$q4$1@fred.mathworks.com>
References: <f9v7iv$76g$1@fred.mathworks.com> <46C5A649.2000705@mathworks.com> <fa4qh4$hli$1@canopus.cc.umanitoba.ca>
Reply-To: "Michele " <denber.nospam@mindspringNOSPAM.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1187742248 836 172.30.248.38 (22 Aug 2007 00:24:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 22 Aug 2007 00:24:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 174773
Xref: news.mathworks.com comp.soft-sys.matlab:424870


roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <fa4qh4$hli$1@canopus.cc.umanitoba.ca>...
> In article <46C5A649.2000705@mathworks.com>,
> Mark Jones  <mark.jones@mathworks.com> wrote:
> >Joel wrote:
> >> I use the Image Aqu toolbox with standard webcams now.   
> >> Looking into buying a wireless camera to replace it but it 
> >> seems like these work a little differently.   They have an 
> >> IP address on a local wireless network and you use your 
> >> webbrowser to view their images.
> 
> >Currently we do not support these types of cameras
because they are only 
> >usable through a web browser.
> 
> Perhaps urlread() could be used?

I'm working on this right now.  If your web cam is not
password protected, this should be easy.  For example, I
have a TrendNet IP-100W camera that doesn't require a
password.  I can load its video into Matlab with the single
command:

img = imread ('http://192.168.0.100/image.jpg') ;

The camera server stores the current frame in a file called
"image.jpg".  Your camera might be different.  Just connect
to it from a browesr and then view the page source - it
should be in there.

My problem is getting Matlab to do the WWW authentication
properly.  The TrendNet cameras use Basic authentication.  I
can easily do the Base 64 encode of the user name and the
password.  Unfortunately, for me this ends with an "=" sign.
 For some reason, Matlab insists on writing this out on the
wire as "%3D" (ie. the 3 separate bytes 25 33 44) instead of
the single byte 3D (which is hex for "=").  The camera then
gives me a password error.

Here's my code:

opt{1} = {'Authentication: Basic'}
opt{2} = {base64encode ('username:password')}
urlread ('http://192.168.0.101', 'POST', opt)

This is in R6 v.13 on a PC with XP if that matters.

I'm stuck.  How can I get urlread to write "=" out as one
byte, 3D?  Any help would be appreciated.  Thanks!