impactoz
Full Member
Posts: 142
Raspberry Pi: Yes
|
Post by impactoz on Sept 24, 2019 5:07:45 GMT -8
I am kind of pleased…. Increased the pictures taken - or decreased the frequency - and I finally captured some stars moving across the screen (towards the end). I do have to replace the camera - so many dead pixels - don't notice in daytime, but is giving me the irits at night... Cant see any dust on the camera or UV glass - all looks clean, but the color red etc on the pixels - I think might mean there is some dead pixels floating around on my camera skyweather.weatherstem.com/thornburyI do love the night images though... and I even saw a rainbow briefly on last nights video...
|
|
|
Post by SDL on Sept 24, 2019 18:26:11 GMT -8
Interesting. Very interesting. You can perform a filter to filter out the dead pixels (since they do not move), Funny how none of us notice the dead pixels. I assume you are using the SkyCamera? Be very interesting to see the regular much more expensive PiCamera. Software compatible BTW.
BP
|
|
|
Post by topher2880 on Sept 26, 2019 16:37:37 GMT -8
Taking a few looks at your SkyCam over the last cpl days, its true what the rest of us think about Melbourne.... its always dreary hahahaha
|
|
impactoz
Full Member
Posts: 142
Raspberry Pi: Yes
|
Post by impactoz on Sept 27, 2019 0:34:37 GMT -8
Your just jealous that you cant get 4 seasons in one day... This morning brilliant sunshine for an hour - was getting quite warm.. then the clouds moved in and I had to turn the heater on... It drizzled a little... and tonight we get a nice sunset with no clouds...
Much more interesting than a boring day of nothing but the same.... lol
Anyway this hardware will move to central Victoria in 2 weeks now that I am satisfied it runs well - once it gets over that great dividing range, it will be a different story!
Waiting for the darkness to fully arrive - swapped my camera out for another to see if I get better night time images tonight!
|
|
impactoz
Full Member
Posts: 142
Raspberry Pi: Yes
|
Post by impactoz on Sept 27, 2019 1:18:30 GMT -8
OH MAN - WHAT A DIFFERENCE !!! So I swapped out my SkyWeather camera for a PI v2.1 NOIR Camera... Left all my code the same - so once its dark it takes a 6 second exposure just like before... I got to see only a couple of pictures before dusk - they looked sharper... good color… I was having a redish tinge bleed on the left with the SkyWeather camera - now with the Raspberry PI official camera - its gone... All good - I can see no sign of dead pixels with the v2.1 camera - so I am thinking it was just simply a quality issue - got a bad camera with the kit... HOWEVER - a 6 second exposure on this camera - turns night into daylight... After sunset tonight - I could still see a blue sky and clouds... It was definitely dark out there - but the picture was as if it was taken in broad daylight! I checked everything…. even moved the camera to be sure - and the picture changed. Now that its all overcast and cloudy (yes topher its Melbourne!) my picture is all washed out - no blue sky at all... Everything is completely white !!! I deliberately have it showing a neighbours roof - and the red tiles are showing red.... I guess the NOIR is really working.... Its a completely different camera setup now ! Might be sharper, might have better colors - but I have lost my night shots now - as night has turned into daylight!!!! Will leave it along tonight, so you can see it in tomorrows video (the top left will show Night Vision and the time will be after 18:30pm to prove its actually night time) - I am amazed at the difference.... Must be all the light pollution of the suburbs reflecting off the clouds that has never been visible before!!! I pinched this camera off my new project of building a meteor (ufo ?) detector - and did research and found the suggestions of using the NOIR camera for night time shots - but not so sure now I have seen the results! Tomorrow night I will experiment - it might not need to do a long exposure at all - I might be taking 2 photos... a long exposure to check for cloud coverage and a short exposure to show stars ?
|
|
impactoz
Full Member
Posts: 142
Raspberry Pi: Yes
|
Post by impactoz on Sept 27, 2019 4:02:39 GMT -8
It got the better of me.... I hated the redish brown - so modified it to at least turn it into black / white - which is what I would like to see for night shots.... looking better at least... And I am starting to see a couple of stars as the clouds move on (Yes topher - Melbourne is moving to another season tonight - LOL)
Added the code to turn the image to black and white in taking a night shot... (In case any of you guys want to upgrade the camera...)
cmd = "raspistill -q 100 -t 1 -ss 5000000 -vf -hf -sh 0 -co 50 -br 50 -sa 0 -ev +2 -w 1920 -h 1080 -ex night -awb auto -ISO 800 -mm average -n -o static/skycamera.jpg" subprocess.call(cmd, shell=True)
#Add the following lines if your using a NOIR camera - turn the image to BW as its too colorful! color_image = Image.open("static/skycamera.jpg") bw = color_image.convert('L') bw.save("static/skycamera.jpg")
print "Night time exposure Completed"
|
|
|
Post by topher2880 on Sept 27, 2019 5:26:16 GMT -8
I am using the cheapo v1.3 and getting really dark sky. This could be because of no light pollution, or maybe the quality of the camera. Im loving the look of your night shots and looking forward to seeing the video from tonight at lunchtime tomorrow, depending on whether GWS are getting flogged or not in some sort of sporting event there tomorrow. I will look forward to playing around and seeing what I can get PS, I saw a cloud today, it was very exciting
|
|
|
Post by SDL on Sept 29, 2019 9:23:53 GMT -8
Wow, you guys have made a lot of progress. Could one of you post the final code for this feature and I'll figure out how to add it into the official code space during Bugweek October 2019.
BP
|
|
impactoz
Full Member
Posts: 142
Raspberry Pi: Yes
|
Post by impactoz on Sept 29, 2019 15:07:15 GMT -8
Wow, you guys have made a lot of progress. Could one of you post the final code for this feature and I'll figure out how to add it into the official code space during Bugweek October 2019. BP My sat.mp4 has some interesting footage... 7 Seconds in - transition from day to night... Need to do a little more work / thinking of - but to see the cloud coverage change is interesting... The NOIR v2.1 Camera really picks up low light... Mostly cloud coverage all night - but at 8 to 9 seconds in, enough of a clearing to see some stars... I think it might be orion you see move across the screen... (01:50 to 02:36). I cant wait to see this at my true location with no light pollution to show the milky way... I am surprised I have never caught an aircraft in day or night time shots I have seen - as it is pointing straight across the East-West runway of Melbourne.... 13- 14 Secs in.... The transition from night to Day - I still think is over exposed... Again that pesky good NOIR... I might need to change my timing over using different values of dusk, sunrise, etc... But I need to wait really for clearer weather to see what is happening... Anyway - here is the current code I am using - always experimental.... My complete SkyCamera.py for ya! Have fun!
import requests
import time
import picamera
import state
import hashlib
from PIL import ImageFont, ImageDraw, Image
import traceback
import util
import datetime as dt
import astral # Need to install this via sudo pip install astral
import pytz
import subprocess
# Check for user imports
try:
import conflocal as config
except ImportError:
import config
def SkyWeatherKeyGeneration(userKey):
catkey = "AZWqNqDMhvK8Lhbb2jtk1bucj0s2lqZ6" +userKey
md5result = hashlib.md5(catkey)
#print ("hashkey =", md5result.hexdigest())
return md5result.hexdigest()
def takeSkyPicture():
sun_altos = astral.Location(info=("Melbourne", "AUS", -37.180594, 144.324194, "Australia/Victoria", config.BMP280_Altitude_Meters))
sun_altos.solar_depression = "civil"
result = sun_altos.sun(date=dt.date.today())
sunsettime = result['sunset']
sunsettimeplus10 = sunsettime + dt.timedelta(minutes=10)
sunsettimeless1h = sunsettime + dt.timedelta(hours=-1)
tz = pytz.timezone('Australia/Sydney')
currtime = dt.datetime.now(tz)
print "Sunset: " , sunsettime
print "Sunset + 10 mins: " , sunsettimeplus10
print "Sunset - 1hr: " , sunsettimeless1h
print "Current Time: " , currtime
if dt.datetime.now().time() > result['dawn'].time() and dt.datetime.now().time() < result['dusk'].time():
#Daytime
print "Daytime picture Started"
nightvishdr =""
camera = picamera.PiCamera()
camera.exposure_mode = "auto"
camera.rotation = 180
camera.resolution = (1920, 1080)
time.sleep(2)
camera.capture('static/skycamera.jpg')
time.sleep(2)
camera.close()
print "Daytime picture Completed"
else:
#Nighttime
print "Night time exposure Started"
nightvishdr =" - Night Vision"
cmd = "raspistill -q 100 -t 1 -ss 5000000 -vf -hf -sh 0 -co 50 -br 50 -sa 0 -ev +2 -w 1920 -h 1080 -ex night -awb auto -ISO 800 -mm average -n -o static/skycamera.jpg"
subprocess.call(cmd, shell=True)
#Add the following lines if your using a NOIR camera - turn the image to BW as its too colorful!
color_image = Image.open("static/skycamera.jpg")
bw = color_image.convert('L')
bw.save("static/skycamera.jpg")
print "Night time exposure Completed"
print "Picture Saved"
# We have either a night time or day time picture - lets add the information header on it
time.sleep(2) # Just in case...
pil_im = Image.open('static/skycamera.jpg')
draw = ImageDraw.Draw(pil_im)
font = ImageFont.truetype("/usr/share/fonts/truetype/freefont/FreeSans.ttf", 25)
# set up units
#wind
val = util.returnWindSpeed(state.ScurrentWindSpeed)
WindStval = "{0:0.1f}".format(val) + util.returnWindSpeedUnit()
val = util.returnWindSpeed(state.ScurrentWindGust)
WindGtval = "{0:0.1f}".format(val) + util.returnWindSpeedUnit()
val = util.returnTemperatureCF(state.currentOutsideTemperature)
OTtval = "{0:0.1f}".format(val) + util.returnTemperatureCFUnit()
val = state.currentTotalRain
RDval = "{0:0.1f}".format(val) + "mm"
val = state.currentSunlightUVIndex
if val < 3:
UVval = "Low"
elif val >=3 and val < 6:
UVval = "Moderate"
elif val >=6 and val < 8:
UVval = "High"
elif val >=8 and val < 11:
UVval = "Very High"
else:
UVval = "Extreme"
myText = config.HEADERPIC + nightvishdr + ": %s Wind Speed: %s Wind Gust: %s Temp: %s Rain Today: %s UV: %s" % (dt.datetime.now().strftime('%d-%b-%Y %H:%M'),WindStval, WindGtval, OTtval, RDval, UVval)
# Draw the text
color = 'rgb(255,255,255)'
#draw.text((0, 0), myText,fill = color, font=font)
# get text size
text_size = font.getsize(myText)
# set button size + 10px margins
button_size = (text_size[0]+20, text_size[1]+10)
# create image with correct size and black background
button_img = Image.new('RGBA', button_size, "black")
# put text on button with 10px margins
button_draw = ImageDraw.Draw(button_img)
button_draw.text((10, 5), myText, fill = color, font=font)
# put button on source image in position (0, 0)
pil_im.paste(button_img, (0, 0))
bg_w, bg_h = pil_im.size
# Save the image
pil_im.save('static/skycamera.jpg', format= 'JPEG')
time.sleep(2)
if config.Twitter and currtime <= sunsettimeplus10 and currtime > sunsettimeless1h:
print "Twitter: Taking Sunset picture at ", dt.date.today(), dt.datetime.now().time()
print "Twitter: Sunset is calculated at: ", result['sunset'].time()
cmd = "cp static/skycamera.jpg static/sunset.jpg"
subprocess.call(cmd, shell=True)
basewidth = 440 # New Width of the image
img = Image.open('static/sunset.jpg')
# Now Resize and Crop it
# draw.text((0, 0),myText,(255,0,127),font=font)
wpercent = (basewidth / float(img.size[0]))
hsize = int((float(img.size[1]) * float(wpercent)))
img = img.resize((basewidth, hsize),1)
area = (0, 0, 440, 220)
img = img.crop(area)
# Going to add a header of title (from config) and date....
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("/usr/share/fonts/truetype/freefont/FreeSans.ttf", 16)
myText = "Twitter: Sunset at " + config.HEADERPIC + ": %s" % (dt.datetime.now().strftime('%d-%b-%Y'))
color = 'rgb(255,255,255)'
text_size = font.getsize(myText)
button_size = (text_size[0]+20, text_size[1]+10)
button_img = Image.new('RGBA', button_size, "black")
button_draw = ImageDraw.Draw(button_img)
button_draw.text((10, 5), myText, fill = color, font=font)
img.paste(button_img, (0, 0))
# We have a new image, scaled and cropped for common twitter usage - lets save it for use later tonight
img.save('static/sunset.jpg')
if (config.USEWEATHERSTEM == True):
sendSkyWeather()
import base64
def sendSkyWeather():
# defining the api-endpoint
API_ENDPOINT = "https://skyweather.weatherstem.com/"
with open("static/skycamera.jpg", "rb") as image_file:
encoded_string = base64.b64encode(image_file.read())
if (config.SWDEBUG):
print ("--------------------")
print ("SkyCam Package Sending")
print ("--------------------")
if(state.barometricTrend == True):
bptrendvalue = "Rising"
else:
bptrendvalue = "Falling"
currentTime = time.time()
data = {
"SkyWeatherVersion": config.SWVERSION,
"SkyWeatherHardware": config.STATIONHARDWARE,
"api_key": state.WeatherSTEMHash,
"device":{
"key": config.STATIONKEY,
"MAC":config.STATIONMAC,
},
"utc":currentTime,
"sensors":[
{
"name":"OutsideTemperature",
"value": state.currentOutsideTemperature,
"units" : "C"
},
{
"name":"OutsideHumidity",
"value": state.currentOutsideHumidity,
"units" : "%"
},
{
"name":"InsideTemperature",
"value": state.currentInsideTemperature,
"units" : "C"
},
{
"name":"InsideHumidity",
"value": state.currentInsideHumidity,
"units" : "%"
},
{
"name":"RainInLast60Minutes",
"value": state.currentRain60Minutes,
"units" : "mm/h"
},
{
"name":"VisibleSunlight",
"value": state.currentSunlightVisible,
"units" : "lux"
},
{
"name":"IRSunlight",
"value": state.currentSunlightIR,
"units" : "lux"
},
{
"name":"UVSunlightt",
"value": state.currentSunlightUV,
"units" : "lux"
},
{
"name":"WindSpeed",
"value": state.ScurrentWindSpeed,
"units" : "kph"
},
{
"name":"WindGust",
"value": state.ScurrentWindGust,
"units" : "kph"
},
{
"name":"WindDirection",
"value": state.ScurrentWindDirection,
"units" : "degrees"
},
{
"name":"totalRain",
"value": state.currentTotalRain,
"units" : "mm"
},
{
"name":"BarometricPressure",
"value": state.currentBarometricPressure,
"units" : "hPa"
},
{
"name":"Altitude",
"value": state.currentAltitude,
"units" : "m"
},
{
"name":"SeaLevelPressure",
"value": state.currentSeaLevel,
"units" : "hPa"
},
{
"name":"BarometricTrend",
"value": bptrendvalue,
"units" : ""
},
{
"name":"OutdoorAirQuality",
"value": state.Outdoor_AirQuality_Sensor_Value,
"units" : "AQI"
},
{
"name":"IndoorAirQuality",
"value": state.Indoor_AirQuality_Sensor_Value,
"units" : "AQI"
},
{
"name":"LastLightningDistance",
"value": state.currentAs3935LastDistance,
"units" : "km"
},
{
"name":"LastLightningTimeStamp",
"value": state.currentAs3935LastLightningTimeStamp,
"units" : ""
}
],
"solarpower":[
{
"name":"BatteryVoltage",
"value": state.batteryVoltage,
"units" : "V"
},
{
"name":"BatteryCurrent",
"value": state.batteryCurrent,
"units" : "ma"
},
{
"name":"SolarVoltage",
"value": state.solarVoltage,
"units" : "V"
},
{
"name":"SolarCurrent",
"value": state.solarCurrent,
"units" : "ma"
},
{
"name":"LoadVoltage",
"value": state.loadVoltage,
"units" : "V"
},
{
"name":"LoadCurrent",
"value": state.loadCurrent,
"units" : "ma"
},
{
"name":"BatteryPower",
"value": state.batteryPower,
"units" : "W"
},
{
"name":"SolarPower",
"value": state.solarPower,
"units" : "W"
},
{
"name":"LoadPower",
"value": state.loadPower,
"units" : "W"
},
{
"name":"BatteryCharge",
"value": state.batteryCharge,
"units" : "%"
},
{
"name":"WXBatteryVoltage",
"value": state.WXbatteryVoltage,
"units" : "V"
},
{
"name":"WXBatteryCurrent",
"value": state.WXbatteryCurrent,
"units" : "ma"
},
{
"name":"WXSolarVoltage",
"value": state.WXsolarVoltage,
"units" : "V"
},
{
"name":"WXSolarCurrent",
"value": state.WXsolarCurrent,
"units" : "ma"
},
{
"name":"WXLoadVoltage",
"value": state.WXloadVoltage,
"units" : "V"
},
{
"name":"WXLoadCurrent",
"value": state.WXloadCurrent,
"units" : "ma"
},
{
"name":"WXBatteryPOWER",
"value": state.WXbatteryPower,
"units" : "W"
},
{
"name":"WXSolarPower",
"value": state.WXsolarPower,
"units" : "W"
},
{
"name":"WXLoadPower",
"value": state.WXloadPower,
"units" : "W"
},
{
"name":"WXBatteryCharge",
"value": state.WXbatteryCharge,
"units" : "%"
}
],
"cameras":[
{
"name":"Sky Camera",
"image": encoded_string
}
]
}
# sending post request and saving response as response object
r = requests.post(url = API_ENDPOINT, json = data)
#print data
# extracting response text
pastebin_url = r.text
if (config.SWDEBUG):
print("The pastebin URL is (r.text):%s"%pastebin_url)
|
|
|
Post by jrwilling on Sept 30, 2019 5:25:51 GMT -8
OK, I'm all over the camera change to get the improved night time imaging but I have a question?
I would have thought that going the NOIR camera route would cause the colors in the daytime imaging to go all wonky due to the lack of IR filtering. Am I missing something here or did you compensate for that in some fashion?
|
|