On Wed 17-Mar-2010 at 20:36 +0000, Bruno Postle wrote:
One of the suggestions we had for lensfun was that Hugin could gain
an option to submit EXIF and corresponding calibration data every
time it does a stitch. This could be done via HTTP, and if it was
done REST-fully there would be no need for a database application to
receive the data, everything would be in the server logs and
extremely scaleable.
So here is a bit of code as a test. It needs Panotools::Script 0.24
and a couple of standard perl modules.
What it does is to read a .pto project, find the first lens,
gather some lens and EXIF data, and submits it via HTTP (currently
to my home server, but this is configurable).
Run it like this:
lens-submit someproject.pto
..or
lens-submit *.pto
..or even this if you like:
find . -name "*.pto" -exec lens-submit '{}' \;
The data on the server looks like this, it is quite anonymous
(except the ip-address which can be stripped):
192.168.1.99 - - [21/Mar/2010:00:45:58 +0000] "GET
/?w=3968&a=0&Rd=0&d=0&Vx=0&Rb=0&h=2232&Vy=0&g=0&f=0&t=0&e=0&Vc=0&Va=1&Ra=0&Vb=0&v=33.4&c=0&Rc=0&b=-0.000199020908138464&Vd=0&Re=0&FocalLengthIn35mmFormat=60&ImageWidth=3968&ScaleFactor35efl=4.6875&ColorSpace=1&Model=DMC-LX3&ResolutionUnit=2&YResolution=180&FileType=JPEG&FOV=33.3985166785074&FNumber=2.8&ImageHeight=2232&FocalLength=12.8&Software=Ver.1.3++&XResolution=180&Make=Panasonic&ExifVersion=0221
HTTP/1.1" 200 - "-" "lens-submit/0.25"
The difficult bit will be to write a tool that does something useful
with this information.
--
Bruno
--
You received this message because you are subscribed to the Google Groups "hugin and
other free panoramic software" group.
A list of frequently asked questions is available at:
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugin-ptx@googlegroups.com
To unsubscribe from this group, send email to
hugin-ptx+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/hugin-ptx
To unsubscribe from this group, send email to hugin-ptx+unsubscribegooglegroups.com or
reply to this email with the words "REMOVE ME" as the subject.
#!/usr/bin/perl
use strict;
use warnings;
use Panotools::Script;
use Image::ExifTool;
use LWP::UserAgent;
use URI;
my $url = $ENV{LENS_URL} || 'http://oink.postle.net/';
my $agent = new LWP::UserAgent;
$agent->agent('lens-submit/'. $Panotools::Script::VERSION);
$agent->timeout (5);
for my $path_pto (@ARGV)
{
print "Project file: $path_pto\n";
my $pto = new Panotools::Script;
$pto->Read ($path_pto);
unless (scalar @{$pto->Control} > 4)
{
print "Skipping: not enough control points\n"; next;
}
my $image = $pto->Image->[0];
my $query_image = {};
for my $parameter qw/w h f v a b c d e g t Ra Rb Rc Rd Re Va Vb Vc Vd Vx Vy/
{
$query_image->{$parameter} = $image->{$parameter}
if defined $image->{$parameter};
}
my $path_photo = $image->Path ($path_pto);
unless (-e $path_photo)
{
print "Skipping: Can't find $path_photo\n"; next;
}
my $exiftool = new Image::ExifTool;
$exiftool->Options (PrintConv => 0);
my $photo = $exiftool->ImageInfo ($path_photo);
unless (defined $photo->{Make} and defined $photo->{Model})
{
print "Skipping: Incomplete EXIF\n"; next;
}
my $query_photo = {};
for my $parameter qw/ColorSpace ExifVersion FileType FNumber FocalLength FOV
FocalLengthIn35mmFormat ImageHeight ImageWidth Lens LensModel LensType
Make
Model ResolutionUnit ScaleFactor35efl Software SubjectDistanceRange
XResolution
YResolution/
{
$query_photo->{$parameter} = $photo->{$parameter}
if defined $photo->{$parameter};
}
my $uri = new URI ($url);
$uri->query_form (%{$query_image}, %{$query_photo});
my $response = $agent->get ($uri->as_string);
if ($response->is_success) {print 'Submitted: '}
else {print 'Failed: '}
print $query_photo->{Make} .' '. $query_photo->{Model}
.' : '. $response->status_line ."\n";
}