From 8b0078840049dce1e7cea77a62c5937db1aa7550 Mon Sep 17 00:00:00 2001 From: Amos Folarin Date: Tue, 7 Jan 2020 00:09:48 +0000 Subject: [PATCH] basic working tests --- README.md | 0 capture-seq/camera-test.py | 14 ++++++++++++++ composite-img/pil-composite.py | 29 +++++++++++++++++++++++++++++ timelapse/README.md | 7 +++++++ 4 files changed, 50 insertions(+) create mode 100644 README.md create mode 100644 capture-seq/camera-test.py create mode 100644 composite-img/pil-composite.py create mode 100644 timelapse/README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/capture-seq/camera-test.py b/capture-seq/camera-test.py new file mode 100644 index 0000000..547d7b8 --- /dev/null +++ b/capture-seq/camera-test.py @@ -0,0 +1,14 @@ +from picamera import PiCamera; +from time import sleep + +camera = PiCamera() + +#camera upside down so flip +camera.rotation = 180 +#camera.exposure_mode = 'nightpreview' + +camera.start_preview() +for i in range(20): + sleep(3) + camera.capture('/home/pi/Desktop/raspi-cam/dad-test/cat-spy_%s.jpg' % i) +camera.stop_preview() diff --git a/composite-img/pil-composite.py b/composite-img/pil-composite.py new file mode 100644 index 0000000..b317339 --- /dev/null +++ b/composite-img/pil-composite.py @@ -0,0 +1,29 @@ +from PIL import Image +dir = "/home/pi/Desktop/raspi-cam/dad-test/" +fname="cat-spy_" +nimages = range(1,20,1) +compositeImage = Image.open(dir+fname+"%s.jpg" % 0) #image 0 is base +compositeImage.putalpha(1) +blendedImage = Image.open(dir+fname+"%s.jpg" % 0) #image 0 is base +blendedImage.putalpha(1) + + + +for i in nimages: + #bufImage = Image.open("fname%s.jpg" % i) + currImage = Image.open(dir+fname+"%s.jpg" % i) + currImage.putalpha(1) + #alpha composite + compositeImage = Image.alpha_composite(compositeImage, currImage) + + #blended image + blendedImage = Image.blend(blendedImage, currImage, .1) + +#save +compositeImage.save(dir+"composite-test.jpg") +blendedImage.save(dir+"blended-test.jpg") + + +#show composites +compositeImage.show() +blendedImage.show() \ No newline at end of file diff --git a/timelapse/README.md b/timelapse/README.md new file mode 100644 index 0000000..93db08d --- /dev/null +++ b/timelapse/README.md @@ -0,0 +1,7 @@ +#using avconv to create a timelapse with non-zero prefixed input image numbering +#i.e. 1,2,3...300 rather than 0001,0002,...300.respectively image%00d.jpg rather than obased image%03d.jpg) +avconv -r 10 -i cat-spy_%00d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 timelapse.mp4 + +if using a padded numbering system then use e.g. for 3 prefix padded zeros: +avconv -r 10 -i cat-spy_%04d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 timelapse.mp4 +