Comet 2020 Neowise (aka C/2020 F3 NEOWISE) was easily visible in the evening in the Northern hemisphere during the July 19 week end. While the kids were doing a bonfire, I did some DSLR pictures, at 200mm of focal and f/2.8, without bothering with an equatorial mount (most of my time was spent supervising the bonfire and the kids). I had a timer taking one picture per second for 1 second of exposure, ISO 3200.
As usual, I resized the pictures in Python 3:
from PIL import Image
Image.MAX_IMAGE_PIXELS=None #for super large image, avoid decompression bomb error
import os
path =r"G:\Run1\\"
path_out=r"G:\resize\\"
dirs = os.listdir( path )
factor=0.15
fs=str(int(factor*100))
def resize():
i=20000
for item in dirs:
if os.path.isfile(path+item):
print("Processing:",item)
im = Image.open(path+item)
f, e = os.path.splitext(path+item)
imResize = im.resize((int(im.width * factor), int(im.height * factor)), Image.ANTIALIAS)
#imResize.save(f + ' resized'+fs+'percent.jpg', 'JPEG', quality=90)
i+=1
imResize.save(os.path.join(path_out,str(i)+'.jpg'), 'JPEG', quality=90)
resize()
Then I interpolated some additional frames between the pictures using Optical Flow in gmic:
gmic -w -fade_files G:\resize\*.jpg,2,1,-1,1,G:\gmic\interp.jpg
And last combined the images as a movie. I used to create a movie from a list of images using PIPP, except… PIPP was not installed on my machine and I did not feel like installing yet another program. So I went to ffmpeg, which happened to be installed in one of the Python libraries:
ffmpeg -r 60 -pattern_type glob -i 'G:\gmic\*.jpg' -qscale 1 'G:\neowise2020.mp4'
…but got a message telling me that globbing was not supported in the windows version of ffmpeg (globbing is using pattern matching like * and ?, in case you wonder). Sometimes very simple things that should just be a few clicks get difficult…. But, not to surrender to frustration, I remembered I had a Python script doing the same thing in Open CV. The script of course worked flawlessly. It is also the method, I find, that allows most granularity in the setup:
import cv2 #install it with : conda install -c conda-forge opencv, if DLL error use: pip install opencv-contrib-python
import os
"""
Creates a video from a directory of images
"""
#______________________________________________________________________________
# Input folder with the images and output video name
image_folder = r'G:\R2'
video_name = r'G:\CometNeowise2020-2.avi'
#Frames per seconds
framerate=24
# Codec =-1 for pop up window, o for default
# Popular codecs ae H264, DIVX, MJPEG
codec=cv2.VideoWriter_fourcc(*'DIVX')
#______________________________________________________________________________
# Read the images
images = [img for img in os.listdir(image_folder) if img.endswith(".jpg")]
frame = cv2.imread(os.path.join(image_folder, images[0]))
height, width, layers = frame.shape
#Build an OpenCV video object
video = cv2.VideoWriter(video_name, codec, framerate, (width,height))
# Encode the images in the video
for i,image in enumerate(images):
if i%50 == 0:
print("Progressed to image",image)
video.write(cv2.imread(os.path.join(image_folder, image)))
# Release memory
cv2.destroyAllWindows()
video.release()
Reflecting on the workflow, I think I should also do optical flow frame interpolation in Open CV, and have a pure Python workflow, from image resizing, to frame interpolation to movie combination. Next time maybe…
And what about the result? Well at f/2.8 focus is unforgiving, and since I was more occupied with the bonfire and the kids than the camera, focus is far from sharp. I had no intention to post any of it, but since A… asked for it, here we go anyways. My 7 years old took the first series, and my 5 years old the second one.
What about naked eye observation? I could not see the comet with the naked eye from our location (and I have a pretty good night vision). My 7 years old said he could, and I believe he did. The 5 years old also said she could, but she was not looking in the right part of the sky.