LowellObservatory / NightWatch

A system to display a set of important information at an observatory.
2 stars 0 forks source link

Determine format for showing webcam images #13

Closed astrobokonon closed 5 years ago

astrobokonon commented 5 years ago

Questions for further development:

  1. Are any of the desired webcams on the private network?

  2. Are static frames grabbed at some specified cadence ok? If so, does the cadence need to be available to control/alter or is 1x/min ok?

  3. Do we need to be able to move the pan/tilt cameras or control the IR LED blasters?

Most of the cameras are RTSP-enabled, making it easier to get a fully-fledged video stream out of them. It remains an open question whether an RTSP stream could be embedded in a django site without any browser plugin shenanigans but hey it's 2018 so who knows.

dyerlytle commented 5 years ago

Here is a little Bokeh python program to grab the current DCT all sky camera JPG image, display it, and update it every minute (in order to use JPG images instead of PNG images I needed to install "node.js" by doing "conda install nodejs", PNG images work without installing nodejs). This Bokeh app is run in the Bokeh server and the Django/Isotope page grabs it through a web socket to be displayed in a DIV:

from bokeh.layouts import row, column, gridplot
from bokeh.models import ColumnDataSource, Slider, Select
from bokeh.plotting import curdoc, figure
from bokeh.driving import count

x_range = (-20,-10) # could be anything - e.g.(0,1).  # random stuff, never displayed
y_range = (20,30)     # more random scale stuff, never displayed, probably don't need this.
p = figure(x_range=x_range, y_range=y_range, plot_height=800). # currently 800x800
p.toolbar.logo = None
p.toolbar_location = None
p.axis.visible = False
img_path = 'http://dct-allsky.lowell.edu/allsky/dct_allsky.jpg'
#img_path = 'https://lowell.edu/skycamftp/dct_allsky.jpg'

def update():
    p.image_url(url=[img_path],x=x_range[0],y=y_range[1],w=x_range[1]-x_range[0],h=y_range[1]-y_range[0])

update()
curdoc().add_root(column(gridplot([[p]], toolbar_location=None, plot_width=800)))
curdoc().add_periodic_callback(update, 60000)
curdoc().title = "ASC"
astrobokonon commented 5 years ago

Initial webcam grabbing code is up in Camelot now: WebcamMcWebcamface. I'm apparently going all-in on my silly prototype names, so expect more.

It's exporting images once a minute and putting them up at http://dctsleeperservice:8080/dctwebcams/dct/ with error images being generated (with timestamps) to show cameras that are unresponsive; sample error image looks like this:

image

I'm not archiving any images, just overwriting with the next/current one. If we want to do little short animations for some reason, we can, but that might be too many moving things on the screen at that point (DCT parameters, weather, etc.).

Other cameras can be added trivially if they're the same type out at the DCT; if they're a different type it can probably be worked around with the framework I put into place, but it'll depend on the camera. Specifically I'm thinking of @charlesvbw and construction cams but you might have that solved already with an off-the-shelf product; I didn't go down the RTSP stream route because of laziness but that could be a fun experiment too since all of our DCT cameras support it (I think).

astrobokonon commented 5 years ago

Closing now, since it seems likely that we'll leave the RTSP can-of-worms closed and just link to the latest static images grabbed by the containerized form of WebcamMcWebcamface. If the users want animations, we've got a path forward on those too.