I am polishing a snapshot webcam viewer. I am trying to detect if the
image the server sent me is the exact same one it sent before (or if I
am getting a cached version, against my wishes. )
In the DOS days, this would be straight forward. I would compute a
checksum of the bits and compare them, also comparing
URLConnection.getLastModified dates and images sizes in the header
(jpg files grow and shrink slightly due to compression when they
change even when the frame size does not change.
But in Java I am puzzled.
the URLConnection getLastModified just gives 0. Any hints on methods
to use or techniques to try? Ideally I would like to use a single
connection where I detect if I am reloading too frequently because the
image is not changing.

Signature
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
> I am polishing a snapshot webcam viewer. I am trying to detect if the
> image the server sent me is the exact same one it sent before (or if I
[quoted text clipped - 12 lines]
> connection where I detect if I am reloading too frequently because the
> image is not changing.
Put capture sequence numbers in a CGI parameter. The advantage here is
that proxy caching is now a good thing. If you want to get really
fancy, you can have the server not reply until the requested sequence is
available.
Client: GET image.jpg
Server: Temp moved, location: image.jpg?seq=85857636
Client: GET image.jpg?seq=85857636
Server: OK, Image 85857636
Client: GET image.jpg?seq=85857637
Server: ....... OK, Image 85857637
Client: GET image.jpg?seq=85857638
Server: ....... OK, Image 85857638
Roedy Green - 26 Jun 2005 08:51 GMT
>Put capture sequence numbers in a CGI parameter. The advantage here is
>that proxy caching is now a good thing. If you want to get really
>fancy, you can have the server not reply until the requested sequence is
>available.
my problem is I have no control over the servers. In fact they may be
downright hostile, trying to stop me from hooking up to their feeds.

Signature
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
Roedy Green - 26 Jun 2005 08:54 GMT
>Put capture sequence numbers in a CGI parameter. The advantage here is
>that proxy caching is now a good thing. If you want to get really
[quoted text clipped - 8 lines]
>Server: ....... OK, Image 85857637
>Client: GET image.jpg?seq=85857638
The problem is webcam servers try to make the stream for webcams also
serve those without working software. They have to use the same URL
every time to serve both purposes. There really should be a Webcam
protocol to avoid sending unchanged images where both server and
client can put a brake on refresh frequency. This is so eau de kludge.
I was astounded googling to discover just how many webcams there are
and how much totally useless traffic they are generating.

Signature
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
Andrey Kuznetsov - 26 Jun 2005 10:10 GMT
Hi Roedy,
> The problem is webcam servers try to make the stream for webcams also
> serve those without working software. They have to use the same URL
> every time to serve both purposes. There really should be a Webcam
> protocol to avoid sending unchanged images where both server and
> client can put a brake on refresh frequency. This is so eau de kludge.
If I understood you right, you want to get image from webcam only if
something changed,
e.g. something has moved.
The solution is easy - you should buy webcam which implements it internally.
Since it is an easy task, there are pretty many cameras which can do such
things (for example from sony)

Signature
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
Roedy Green - 27 Jun 2005 12:43 GMT
>If I understood you right, you want to get image from webcam only if
>something changed,
>e.g. something has moved.
>The solution is easy - you should buy webcam which implements it internally.
>Since it is an easy task, there are pretty many cameras which can do such
>things (for example from sony)
The problem is there is no stream protocol. The JPG to the outside
world is just an ordinary jpg image that he webserver updates rather
frequently. There is no notification it changed or any indication of
when it will change next. You just get in periodically.
My idea was you notice if you are say fetching every 5 seconds, you
are not getting very frequent changes, so you can dynamically stretch
the polling frequency.
You can dynamically track to get the optimum balance between what the
end user desires and the server is currently providing.
What we really need is a standard protocol. It would be unusual as
porotocols go, since most users don't want all the available data.

Signature
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
> I am polishing a snapshot webcam viewer. I am trying to detect if the
> image the server sent me is the exact same one it sent before (or if I
[quoted text clipped - 12 lines]
> connection where I detect if I am reloading too frequently because the
> image is not changing.
Roedy:
You could request only the header. Odds are that the file length has
changed.

Signature
Knute Johnson
email s/nospam/knute/
Roedy Green - 27 Jun 2005 12:45 GMT
>You could request only the header. Odds are that the file length has
>changed.
I am trying to make this work in general, where the bastards give you
-1 length, no timestamps etc. I think it will have to use a layered
set of approaches depending how much info they divulge. I don't think
I will bother with a PixelGrabber. Length should be sufficient.

Signature
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes