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: Fri, 24 Aug 2007 00:15:05 +0000 (UTC)
Organization: Michele Denber (ID: 1-A7A3B)
Lines: 43
Message-ID: <fal7u9$m0r$1@fred.mathworks.com>
References: <f9v7iv$76g$1@fred.mathworks.com> <46C5A649.2000705@mathworks.com> <fa4qh4$hli$1@canopus.cc.umanitoba.ca> <fafvn8$q4$1@fred.mathworks.com> <fai2os$5pa$1@fred.mathworks.com>
Reply-To: "Michele " <denber.nospam@mindspringNOSPAM.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1187914505 22555 172.30.248.37 (24 Aug 2007 00:15:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 24 Aug 2007 00:15:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 174773
Xref: news.mathworks.com comp.soft-sys.matlab:425324


"Matthew Simoneau" <matthew@mathworks.com> wrote in message
<fai2os$5pa$1@fred.mathworks.com>...
> I took a quick look at URLREAD.  In R2007a, line 85 looks
> like this:
> 
>   value = char(java.net.URLEncoder.encode(params{i+1}))
> 
> I think this is where your "=" is becoming "%3D".  This is
> because these values are being passed as part of a form
> submit, and not a header.

Thanks very much, Matthew!  We're halfway there.  Your
analysis of the byte problem was correct.  I modified
urlread by adding a urlConnection.setRequestProperty line
after the urlConnection = url.openConnection;.  Now the
username:password combination gets written out properly and
it looks like the camera server accepts that.

Unfortunately, I still can't read my image.  What's odd is
that, looking at the byte stream using Ethereal, it seems
like the camera is actually sending the requested image (I
see a TCP packet on the wire containing the string "Content
type: image/jpg", followed by lots of imagy-looking bytes)

But from this: imread ('http://192.168.0.103/image.jpg')
I get this:
??? Error using ==> imread
Unable to determine the file format.

If I say: urlread ('http://192.168.0.103/image.jpg')

I get

ans = yØÿâ

The imread does work just fine with a different camera (same
model) that doesn't require authentication.

I'm guessing that urlread isn't picking up the camera server
reply properly.  Or maybe there's some funniness in imread??
 I'm going to work on this some more.  In the meantime, if
anyone else has any ideas, I'd love to hear them.  Thanks
for the help so far!