Weblog Tomasza Przechlewskiego [Zdjęcie T. Przechlewskiego]


scrum
random image [Photo gallery]
Zestawienie tagów
1-wire | 18b20 | 1wire | 2140 | 3rz | adamowicz | afera | alsamixer | amazon | amber | amman | anniversary | antypis | apache | api | applebaum | arm | armenia | astronomy | asus | atom.xml | awk | aws | bachotek | bakłażan | balcerowicz | balta | banan | bash | batumi | berlin | białowieża | białystok | bibtex | bieszczady | biznes | blogger | blogging | blosxom | bme280 | bono | borne-sulinowo | breugel | bt747 | budapeszt | budyniowo | budyń | bursztyn | campagnolo | canon | cedewu | chaos | chello | chiller | chillerpl | chown | christophe dominici | chujowetaśmy | ciasto | cmentarz | contour | coronavirus | covi19 | covid | covid19 | cron | css | csv | cukinia | curl | cycling | d54250wykh | darkages | dbi | debian | dejavu | dhcp | dht22 | dia | docbook | dom | dp1500 | ds18b20 | duda | dulkiewicz | dulkiewiczowa | dyndns | dynia | ebay | economy | ecowitt | ekonomia | elka | elm | emacs | emacs23 | english | ep | erasmus | erasmusplus | ess | eu | eurostat | excel | exif | exiftool | f11 | fc | fc11 | fc15 | fc29 | fc5 | fc8 | fedora | fedora21 | fenix | ffmpeg | finepix | firefox | flickr | folau | fontforge | fontspec | fonty | food | fop | forms | foto | france | francja | fripp | froggit | fuczki | fuji | fuse | gammu | garden | garmin | gas | gawk | gazwyb | gdańsk | gdynia | gender | geo | geocoding | georgia | gft | ggplot | ghost | git | github | gmail | gmaps | gnokii | gnus | google | google apps script | googlecl | googleearth | googlemaps | gotowanie | gphoto | gphoto2 | gps | gpsbabel | gpsphoto | gpx | gpx-viewer | greasemonkey | gruzja | grzyby | gus | gw1000 | haldaemon | handbrake | hhi | historia | history | hitler | holocaust | holokaust | hp1000se | hpmini | humour | iblue747 | ical | iiyama | ikea | imagemagick | imap | inkscape | inne | internet | j10i2 | javascript | jhead | jordania | k800i | kajak | kamera | karob | kibbeh | kleinertest | kml | kmobiletools | knuth | kociewie kołem | kod | kolibki | komorowski | konwersja | krutynia | krynki | kuchnia | kurski | kłamstwo | latex | latex2rtf | latex3 | lcd | legend | lenny | lesund | lewactwo | lgbt-folly | liban | liberation | linksys | linux | lisp | lisrel | litwa | lizbona | logika | ltr | lubowla | lwp | lwów | m2wś | malta | mapquest | mapsource | maradona | marchew | marimekko | marvell | math | mathjax | mazury | mbank | mediolan | mencoder | mevo | mex | mh17 | michalak | michlmayr | microsoft | monitor | mp4box | mplayer | ms | msc | mssql | msw | mswindows | mtkbabel | museum | muzyka | mymaps | mysql | mz | nafisa | nanopi | natbib | navin | neapol | nekrolog | neo | neopi | netbook | niemcy | niemieckie zbrodnie | nikon | nmea | nowazelandia | nuc | nxml | oauth | oauth2 | obituary | ocr | odessa | okular | olympus | ooffice | ooxml | opera | osm | otf | otftotfm | other | ov5647 | overclocking | ozbekiston | padwa | panoramio | paryż | pdf | pdfpages | pdftex | pdftk | pedophilia | perl | photo | photography | pi | picasa | picasaweb | pim | pine | pis | pit | pizero | plain | plotly | pls | plugin | po | podcast | podlasie | podróże | pogoda | politics | polityka | polsat | portugalia | postęp | powerpoint | połtawa | prelink | problem | propaganda | pseudointeligencja | pstoedit | putin | python | pywws | r | r1984 | radio | random | raspberry | raspberry pi | raspberrypi | raspbian | refugees | relaxng | ridley | router | rower | rowery | roztocze | rpi | rsync | rtf | ruby | rugby | rumunia | russia | rwc | rwc2007 | rwc2011 | rwc2019 | rzym | salerno | samba | sds011 | selenium | sem | senah | sernik | sheevaplug | sienkiewicz | signature | sikorski | sks | skype | skytraq | smoleńsk | sqlite | srtm | sshfs | ssl | staszek wawrykiewicz | statistcs | statistics | stats | statystyka | stix | stretch | supraśl | suwałki | svg | svn | swanetia | swornegacie | szwajcaria | słowacja | tbilisi | terrorism | tesseract | tex | texgyre | texlive | thunderbird | tomato | totalnaopozycja | tourism | tramp | trang | transylwania | truetype | trzaskowski | ttf | turcja | turkey | turystyka | tusk | tv | tv5monde | tweepy | twitter | tykocin | typetools | ubuntu | uchodźcy | udev | ue | ukraina | umap | unix | upc | updmap | ups | utf8 | uzbekistan | varia | video | vienna | virb edit | virbedit | vostro | wammu | wdc | wdfs | weather | weathercloud | webcam | webdav | webscrapping | weewx | wenecja | wh2080 | wiedeń | wikicommons | wilno | win10 | windows | windows8 | wine | wioślarstwo | wojna | word | wordpress | wrt54gl | ws1080 | wtyczka | wunderground | ww2 | www | wybory | wybory2015 | włochy | węgry | xemex | xetex | xft | xhtml | xine | xml | xmllint | xsd | xslt | xvidtune | youtube | yum | zaatar | zakopane | zakupy | zawodzie | zdf | zdrowie | zeropi | zgarden | zgony | zprojekt | łeba | świdnica | żywność
Archiwum
02/2023 | 01/2023 | 11/2022 | 10/2022 | 09/2022 | 07/2022 | 06/2022 | 04/2022 | 03/2022 | 02/2022 | 12/2021 | 09/2021 | 03/2021 | 01/2021 | 12/2020 | 11/2020 | 10/2020 | 09/2020 | 08/2020 | 07/2020 | 04/2020 | 03/2020 | 02/2020 | 01/2020 | 12/2019 | 11/2019 | 10/2019 | 09/2019 | 08/2019 | 07/2019 | 06/2019 | 04/2019 | 02/2019 | 01/2019 | 12/2018 | 11/2018 | 10/2018 | 09/2018 | 08/2018 | 07/2018 | 05/2018 | 04/2018 | 03/2018 | 02/2018 | 01/2018 | 11/2017 | 10/2017 | 09/2017 | 08/2017 | 07/2017 | 06/2017 | 05/2017 | 04/2017 | 03/2017 | 02/2017 | 01/2017 | 12/2016 | 11/2016 | 10/2016 | 09/2016 | 08/2016 | 06/2016 | 05/2016 | 04/2016 | 02/2016 | 12/2015 | 11/2015 | 09/2015 | 07/2015 | 06/2015 | 05/2015 | 02/2015 | 01/2015 | 12/2014 | 09/2014 | 07/2014 | 06/2014 | 04/2014 | 02/2014 | 01/2014 | 12/2013 | 11/2013 | 10/2013 | 09/2013 | 08/2013 | 07/2013 | 05/2013 | 04/2013 | 03/2013 | 02/2013 | 01/2013 | 12/2012 | 11/2012 | 10/2012 | 09/2012 | 08/2012 | 07/2012 | 05/2012 | 03/2012 | 02/2012 | 01/2012 | 12/2011 | 11/2011 | 10/2011 | 09/2011 | 08/2011 | 07/2011 | 06/2011 | 05/2011 | 04/2011 | 03/2011 | 02/2011 | 01/2011 | 12/2010 | 11/2010 | 10/2010 | 09/2010 | 08/2010 | 07/2010 | 06/2010 | 05/2010 | 04/2010 | 03/2010 | 02/2010 | 01/2010 | 12/2009 | 11/2009 | 10/2009 | 09/2009 | 08/2009 | 07/2009 | 06/2009 | 05/2009 | 04/2009 | 03/2009 | 02/2009 | 01/2009 | 12/2008 | 11/2008 | 10/2008 | 09/2008 | 08/2008 | 07/2008 | 06/2008 | 05/2008 | 04/2008 | 03/2008 | 02/2008 | 01/2008 | 12/2007 | 11/2007 | 10/2007 | 09/2007 | 08/2007 | 07/2007 |
O stronie
wykorzystywany jest blosxom plus następujące wtyczki: tagging, flatarchives, rss10, lastbuilddatexhtmlmime. Niektóre musiałem dopasować nieco do swoich potrzeb. Więcej o blosxom jest tutaj
Subskrypcja
RSS 1.0
Time lapse: end of first experiment

Because my tomatoes are growing unexpectedly fast I had to stop capturing pictures quicker than I have planned as they do not fit in the frame.

So 2664 pictures was taken from 16.03 to 23.04 at 20 minutes interval. The video size is about 715 Mb and the video length is 3min 43 seconds (at 12 fps or 1:47 at 25 fps).

The videos are available at YouTube: 25 fps | 12 fps

url | Wed, 24/04/2013 16:35 | tagi: , , , , , , , , ,
Pierwszy film poklatkowy

Ustaliłem empirycznie w jaki sposób podłączyć aparat do Raspberry Pi (do SheevaPlug zresztą też) żeby nic się nie zacinało. W skrócie:

  1. Używam kompakta Nikon S3000 (Canon A620 się zacinał/odłączał--sprzedałem go na Allegro).

  2. Podłączam aparat poprzez aktywny USB hub (kupiłem w tym celu cztero-portowy HUB firmy Vivanco).

  3. Po każdym zdjęciu wykonuję reset stosownego portu USB za pomocą programiku pn. usb_reset (zobacz tutaj oraz tutaj).

Kilka aparatów

Używam dwóch aparatów Nikon S3000 (kupionych na Allegro oczywiście), więc jest problem z ustaleniem który jest który:

$gphoto2 --auto-detect
Model                          Port                                            
----------------------------------------------------------
Nikon Coolpix S3000 (PTP mode) usb:001,022     
Nikon Coolpix S3000 (PTP mode) usb:001,021  

Można użyć opcji --port usb:001,022 aby wykonać coś z ,,pierwszym'' aparatem oraz --port usb:001,021, aby dostać się do drugiego. Oczywiście umieszczenie numerów portów na-zicher w skryptach byłoby kiepskim pomysłem ponieważ nie są one ustalone, ale się zmienią jeżeli urządzenie zostanie odłączone/przyłączone ponownie. Lepszym sposobem zidentyfikowania aparatów jest wykorzystanie numeru seryjnego:

## $gphoto2  --get-config serialnumber --port PORT
## example
$gphoto2  --get-config serialnumber --port usb:001,022
Label: Serial Number                                                           
Type: TEXT
Current: 000047514512

Mam czarnego Nikona o numerze 000041076602 oraz różowego o numerze 000047514512. Używam następującego skryptu do wykonania zdjęcia określonym aparatem:

#!/bin/bash
PINK_CAM_ID='000047514512'
BLACK_CAM_ID='000041076602'

while test $# -gt 0; do
  case "$1" in
    -b|--black)   REQ_CAM="$BLACK_CAM_ID";;
    -p|--pink)    REQ_CAM="$PINK_CAM_ID";;
  esac
  shift
done

## Nazwa pliku ze zdjęciem:
FILENAME="NIK`date +"%Y%m%d%H%M"`.jpg"

## Przejrzyj wszystkie podłączone aparaty:
while read PORT_ID 
do 
        ##echo $PORT_ID 
        ## -n means string is non-empty
        if [ -n "$PORT_ID" ] ; then
                CAM_ID=`gphoto2 --get-config serialnumber --port $PORT_ID | awk '/Current:/ { print $2 }' `
                if [ $CAM_ID = "$REQ_CAM" ] ; then
                        REQ_CAM_PORT="$PORT_ID"
                        ##echo "*** Req Camera ID: #$CAM_ID."
                fi
        fi
        
done <<< "`gphoto2 --auto-detect | grep usb | awk '{ print $6}'`"

# Na wypadek błędu wyślij alarmowego SMSa
if [ -z "$REQ_CAM_PORT" ] ; then
      echo "*** Error: Camera $REQ_CAM not found ***"
      ## sent a SMS cf http://pinkaccordions.homelinux.org/wblog/sms_alerts_with_google_calendar.html
      sms_reminder.sh
      exit 1   
fi

## reset USB 
REQ_CAM_PORT_DEVNAME=`echo $REQ_CAM_PORT | sed 's/^.*://' | sed 's/,/\//'`
usb_reset /dev/bus/usb/${REQ_CAM_PORT_DEVNAME}

LANG=C gphoto2 --port "$REQ_CAM_PORT" --force-overwrite --set-config flashmode=1 \
   --set-config d002=4 \
   --capture-image-and-download --filename "$FILENAME"

## reset USB (powtórny) 
usb_reset /dev/bus/usb/${REQ_CAM_PORT_DEVNAME}

Właściwość d002 ustawia rozdzielczość zdjęcia (4 oznacza 2592x1944).

Wartość 1 właściwościflashmode wyłącza flash.

Z moich eksperymentów wynika, że bez wykonania usb_reset bateria aparatu nie jest doładowywana (czemu?) i po pewnym czasie z powodu braku zasilania aparat odłącza się.

Film

Po czterech tygodniach mam wystarczająco dużo zdjęć aby spróbować zrobić pierwszy film.

Najpierw konwertuję wszystkie zdjęcia do rozdzielczości 1920x1080 za pomocą programu convert (z zestawu ImageMagick) uruchamianego z ,,wewnątrz'' prostego skryptu Perla. Ponieważ nazwy plików wejściowych są konstruowane wg schematu NIKYYYYMMDDHHMM.jpg (gdzie YYY to rok, MM oznacza miesiąc, itd.) sortowanie alfabetyczne oznacza ustawienie ich także we właściwym porządku chronologicznym. Nazwy plików wynikowych są zaś konstruowane jako: hd1920_00001.jpg, hd1920_00002.jpg, itd.

#!/usr/bin/perl

opendir (DIR, ".");
my  @files = sort { $a cmp $b } readdir(DIR);

while (my $file = shift @files ) {
   if ($file =~ /.jpg$/) {  $fileNo++;
      $file_out = sprintf "hd1920_%05d.jpg", $fileNo;
      print "$file -> $file_out\n";
      system ("convert", $file, "-geometry", "1920x1080", "$file_out");
   }
}

Okazało się, że jest dokładnie 1784 zdjęć:

$ls -l hd1920_0* | wc -l
1784

Konwersja trwała około 30 min na moim przeciętnym zupełnie PC-cie. Każdy plik wynikowy miał około 0,5Mb; wszystkie razem zajmowały około 0,85Gb:

$ls -l hd1920_0* | awk '{t+=$5}; END{print t}'
853332231

Film został wykonany za pomocą programu ffmpeg:

ffmpeg -r 12 -qscale 2 -i hd1920_%05d.jpg Tomato_12.mp4

Gdzie -r 12 oznacza liczbę klatek na sekundę (12 fps) a -qscale określa jakość (1 oznacza najlepszą, 32 najgorszą jakość).

Film ma około 450 Mb. Konwersja zajmuje około 3min (on my decent PC) a długość filmu to 2min i 29 sekundy.

Film przedstawia sadzonkę pomidora (Pinkaccordion oczywiście :-). Zdjęcia były robione co 20 minut od 16 marca do 11 kwietnia.

Są także wersje na 25 fps oraz 6 fps.

url | Mon, 15/04/2013 17:05 | tagi: , , , , , , , ,
Time lapse: first production

After almost 4 weeks I have enough pictures to create my first video production. (How to capture images with a still camera attached to Raspberry Pi is described here and here.)

I started from converting all pictures to 1920x1080 resolution with convert run from a simple Perl script. As the input file names are constructed as NIKYYYYMMDDHHMM.jpg (where YYY denotes year, MM denotes month etc) alphabetic sorting is OK. The resulting files are named as hd1920_00001.jpg, hd1920_00002.jpg, etc.

#!/usr/bin/perl

opendir (DIR, ".");
my  @files = sort { $a cmp $b } readdir(DIR);

while (my $file = shift @files ) {
   if ($file =~ /.jpg$/) {  $fileNo++;
      $file_out = sprintf "hd1920_%05d.jpg", $fileNo;
      print "$file -> $file_out\n";
      system ("convert", $file, "-geometry", "1920x1080", "$file_out");
   }
}

There are exactly 1784 pictures:

$ls -l hd1920_0* | wc -l
1784

Conversion of all images lasted circa half an hour on my decent PC. Each picture size is about 0,5Mb, while the total size is 0,85Gb:

$ls -l hd1920_0* | awk '{t+=$5}; END{print t}'
853332231

To create a video from the images I run ffmpeg now:

ffmpeg -r 12 -qscale 2 -i hd1920_%05d.jpg Tomato_12.mp4

Where -r 12 means frames ratio (12 fps) and -qscale determines video quality (1 denotes best quality and 32 is the lowest one).

The video size is about 450 Mb. The conversion takes circa 3min (on my decent PC) and the video length is 2min 29 seconds.

The movie's subject is a growing tomato (Pinkaccordion variety of course:-). The photographs were taken every 20 minutes from March 16th to April 11th.

There are versions at 25 fps and 6 fps as well.

url | Fri, 12/04/2013 12:15 | tagi: , , , , , , , , ,
Raspberry Pi: some progress with time-lapse photography

I have made some progress in accessing still camera with gphoto2 (cf. here). The detailed description of my set-up will be disclosed within a few weeks (as I am still not sure if it is 100% success:-). In short:

I changed camera from Canon A620 to Nikon S3000.

I connected camera with active USB hub.

On every capture USB port is reset with usb_reset utility (cf here and here)

Multiple cameras

I use two Nikon S3000 compact cameras so there is a problem how to identify which is which.

$gphoto2 --auto-detect
Model                          Port                                            
----------------------------------------------------------
Nikon Coolpix S3000 (PTP mode) usb:001,022     
Nikon Coolpix S3000 (PTP mode) usb:001,021  

So one can use --port usb:001,022 option to access first attached camera and --port usb:001,021 to access the second one. Of course hard-coded port numbers are troublesome as they are not fixed and change if the device is disconnected/connected again. Better way to identify the camera is to use it's serial number:

## $gphoto2  --get-config serialnumber --port PORT
## example
$gphoto2  --get-config serialnumber --port usb:001,022
Label: Serial Number                                                           
Type: TEXT
Current: 000047514512

I have black Nikon with 000041076602 serial number and pink one with 000047514512 serial number. I use the following bash script to access the cameras:

#!/bin/bash
PINK_CAM_ID='000047514512'
BLACK_CAM_ID='000041076602'

while test $# -gt 0; do
  case "$1" in
    -b|--black)   REQ_CAM="$BLACK_CAM_ID";;
    -p|--pink)    REQ_CAM="$PINK_CAM_ID";;
  esac
  shift
done

## Picture filename:
FILENAME="NIK`date +"%Y%m%d%H%M"`.jpg"

## Scan all attached cameras:
while read PORT_ID 
do 
        ##echo $PORT_ID 
        ## -n means string is non-empty
        if [ -n "$PORT_ID" ] ; then
                CAM_ID=`gphoto2 --get-config serialnumber --port $PORT_ID | awk '/Current:/ { print $2 }' `
                if [ $CAM_ID = "$REQ_CAM" ] ; then
                        REQ_CAM_PORT="$PORT_ID"
                        ##echo "*** Req Camera ID: #$CAM_ID."
                fi
        fi
        
done <<< "`gphoto2 --auto-detect | grep usb | awk '{ print $6}'`"


if [ -z "$REQ_CAM_PORT" ] ; then
      echo "*** Error: Camera $REQ_CAM not found ***"
      ## sent a SMS cf http://pinkaccordions.homelinux.org/wblog/sms_alerts_with_google_calendar.html
      sms_reminder.sh
      exit 1   
fi

## reset the USB device
REQ_CAM_PORT_DEVNAME=`echo $REQ_CAM_PORT | sed 's/^.*://' | sed 's/,/\//'`
usb_reset /dev/bus/usb/${REQ_CAM_PORT_DEVNAME}

LANG=C gphoto2 --port "$REQ_CAM_PORT" --force-overwrite --set-config flashmode=1 \
   --set-config d002=4 \
   --capture-image-and-download --filename "$FILENAME"

## reset the USB device again
usb_reset /dev/bus/usb/${REQ_CAM_PORT_DEVNAME}

Property d002 sets picture resolution (4 means 2592x1944).

Value 1 of flashmode turns-off flash.

It seems that without usb_reset there are problems with battery charging (why?)

url | Thu, 04/04/2013 21:26 | tagi: , , , , , , , , ,
Raspberry Pi: first steps with time-lapse photography
A620 powered with CA-PS500 adapter
A620 powered with CA-PS500
A620 with improvised sun cover
A620 (side view)

I would like to remote control a still camera via gphoto2. After consulting a  list of supported cameras I bought (used) Canon A620 from Allegro (local Internet auction site, sort of E-bay).

This camera has many great features (I suspect even too great as Canon stop producing cheap cameras of this sort): viewfinder, retractable LCD and can be powered with Compact Power Adapter CA-PS500 instead of batteries (an important feature in my project). The plan was simple: connect camera via USB cable to computer and power it with PSU. Capture photos periodically with gphoto2:

 gphoto2 --auto-detect
     
 pi@raspberrystar ~/bin $ gphoto2 --auto-detect
 Model                          Port                                            
 ----------------------------------------------------------
 Canon PowerShot A620 (PTP mode) usb:001,006    

So far, so good.

Now, I tried to capture a photo:

# one shot without flash, download the file and store in a file named as: GPHyyyymmddhhmm.jpg
LANG=C gphoto2 --set-config flashmode=0 --capture-image-and-download --filename "GPH%Y%m%d%H%M.jpg"

As the creation time is wrong (due to camera wrong clock) I modified the above as follows (note that touch is used to adjust file's timestamp):

#!/bin/basg
FILENAME="GPH`date +"%Y%m%d%H%M"`.jpg"

LANG=C gphoto2 --set-config flashmode=0 --capture-image-and-download --filename "$FILENAME"
touch "$FILENAME"

Unfortunately there are problems: I am able to remotely capture only one photo. Next remote capture try results in an error and the camera has to be hard reset (with power on/off button). The problem is reported by others too.

BTW: when I connected the camera to my PC the reliability is much better (but seems not perfect---I experienced camera disconnection too.)

My first try to resolve the problems was to update gphoto2 (raspbian contains version 2.4.14 of gphoto2).

Compiling newest (march 2013) version of gphoto2 on Raspberry Pi

## optionally remove old version (there are no dependencies)
apt-get remove gphoto2

There is no need to remove gphoto2 as compiled one will be installed in another directory (/usr/local/ vs /usr/).

First install/compile the necessary packages:

apt-get install -y libltdl-dev libusb-dev libexif-dev libpopt-dev

## Download and install newer version of libusb 1.0.11
wget http://ftp.de.debian.org/debian/pool/main/libu/libusbx/libusbx_1.0.11.orig.tar.bz2
tar xjvf libusbx_1.0.11.orig.tar.bz2
cd libusbx-1.0.11/

./configure &&  make && sudo make install

## Download and install newer version of libgphoto
wget http://garr.dl.sourceforge.net/project/gphoto/libgphoto/2.5.1.1/libgphoto2-2.5.1.1.tar.bz2
tar xjf libgphoto2-2.5.0.tar.bz2
cd libgphoto2-2.5.1.1

./configure &&  make && sudo make install

Download and install newer version of gphoto2

wget http://downloads.sourceforge.net/project/gphoto/gphoto/2.5.1/gphoto2-2.5.1.tar.gz
tar xzvf gphoto2-2.5.1.tar.gz
cd gphoto2-2.5.1

./configure &&  make && sudo make install

## run ldconfig
sudo ldconfig
gphoto2 --version
gphoto2 2.5.1

Copyright (c) 2000-2013 Lutz Mueller i inni

BTW compiling gphoto2 on my fedora 14 box requires to install libtool-ltdl-devel popt-devel first:

#configure: error: cannot compile and link against libltdl
#libgphoto2 requires libltdl (the libtool dl* library),
#but cannot compile and link against it.

yum -y install libtool-ltdl-devel popt-devel

Upon installing above two packages, the compilation of libusb, libgphoto and gphoto2 proceeds smoothly.

Unfortunately installing new version of gphoto2 did not help.

The problem will be further examined...

url | Wed, 06/03/2013 19:23 | tagi: , , , , , ,