Saturday 22 August 2015

Advance and be Recognized

Another important component of my weather server (MetCommand-Home) is the sky-recognizer program.

Every five minutes, a webcam aimed out of an upstairs window snaps a shot of the sky. Usually, that's as far as it would get. But I wanted to have real observations, and not something I'd be having to update manually every few hours.

I finally settled on programming something, wxSky, that would do the job.

wxSky examines the pixels of an image and comes up with an observation. Currently, the list of observations is:

- Sunny (daytime only)
- Cloudy
- Twilight
- Clear (nighttime only)

The sky condition is gauged by examining the colour channels of the image, both separately and together. The rules are relatively simple and are accurate at least 90% of the time, although it can be difficult to detect clouds on a summer's night--contrast that with winter, when the ground is covered by snow and glowing in all the light pollution, and the clouds light up just fine. Partly cloudy would be more difficult to detect, and I find that, 90% of the time, sunny or cloudy does just fine.

It is, of course, a GUI program, with an editable parameters file, Linux-style (in fact, the production version runs on Linux).


wxSky v 1.27

It's difficult to see in this photo, but in the upper-left-hand corner of the window is mostly administrative stuff--the time and date; the latest observation, the middle is a view of the picture as nine averaged zones, with the Sweet Spot (more on this shortly) highlighted. Below that is a box simply recording the last five observations.

The upper right-hand corner is a view of the average values for the nine zones of the picture. Three buttons--R, G and B--are for selecting Red and/or Green and/or Blue channels.

Finally, there is one composite (master) value--displayed for R, G and B channels (and combined). These are averaged values for the entire picture.

Below that there is the same display, but for the Sweet Spot, which is a user-selectable zone (1/9 of the pic).

Why all the RGB breakouts? Because different sky conditions are based on colour-channel values. Twilight is a deep blue, a bit of green, and almost no red. Sunny is a deep blue with a good helping of green and a little red. Cloudy is almost equal values of red, green and blue; or, at night, with significant red, some green and almost no blue. Easy access to those values is important when calibrating the program to a new camera.

Why a Sweet Spot? Because your camera could be facing in any direction or (like mine) be partially obscured in a particular zone. I personally find that zone 7 (lower-left corner) has the best values.

The output of the program is a single text file simply containing one line with the date and time of the observation, and the observation itself. This is handed off to wxOCR, the LCD recognizer, for incorporation into an observations packet.

The weather server (Centretown Observatory) is available at:
http://mizar64.dyndns-home.com:64180/weather.html.

-Bill

No comments:

Post a Comment