Hi all,

I have not had all the time I wanted to dedicate to this, so it is uncomplete. Herewith I share the current draft, hoping that somebody will pick it up and continue from here.

Architecture: a mysql database with web based input / output. Export format, relevant for the desktop tools using the db, XML.

Two type of inputs: deterministic (i.e. specific correction parameters as determined by a volunteer who intended to calibrate the lens) and stochastic (i.e. the parameters obtained while optimizing a hugin project). Credit goes to Bruno Postle and JD Smith on the hugin-ptx list for this second approach. In both approaches the critical settings are proper physical lens set up. The deterministic approach relies on the volunteer to set 100% perfectly, which is seldom the case. The stochastic approach is based on mean-reversion and relies on the fact that the set up errors of many users in many project will cancel each other out.

In the output, the user is free to decide on which of the two processes he prefers to rely. Can output the whole database, or lens/camera specific XML.

The database is in the attachement, with a bit more analysis and a short todo list.

License is http://creativecommons.org/licenses/by/3.0/ - though this code could be released in the public domain as far as I am concerned. The value here is not the code, but the data in the database which takes a lot of effort to collect and refine.

Comments and critique welcome.

enjoy the summer!
Yuv
http://www.photopla.net/070606main.php
(C) 2007 Yuval Levy, released under http://creativecommons.org/licenses/by/3.0/

1. INPUT

This database will accept two types of lens calibration profiles:
deterministic and stochastic. The stochastic process was suggested by Bruno
Postle and JD Smith on the hugin-ptx mailing list.

1.1. DETERMINISTIC PROCESS
* volunteer logs in to the web based system
* volunteer fills out a web based form to populate ci_calinfo as well as
  one instance of distorsion and vignetting parameters. One hit on the
  form per each set of focal distance and aperture. Up to four files
  (three images and one hugin project file) per hit will be stored.
* maintainer goes over new entries in ci_calinfo and assigns ambiguous
  camera/lens definition to unique disambiguated id
* maintainer verifies calibration


1.2. STOCHASTIC PROCESS
* user create a login to the web based system
* user allows hugin to transfer relevant project information
  (calibration parameters)
* each project generates a hit on the database and populates ci_calinfo as well
  as one instance of distorsion and vignetting parameters.
* hugin might send in an evaluation of how good the parameters are
  (Pablo d'Angelo)
* maintainer uses statistic tools and methods to weed out stray parameters and
  come up with a calibration output that is then exported via XML.

The database is expandable: when new/different/better algorithms become known
(such as suggested by Alexandre Jenny on hugin-ptx), a new table can be added
for those parameters, like the vi_vignetting table if the parameters are
aperture-dependent or by expanding the dp_distorsion table if they are only
focal-length dependent.

2. OUTPUT

The PHP code will generate, based on selection parameters, an XML export for
selected camera/lens combos. Selection parameters are:
- type of profile (deterministic/stochastic)
- quality level
-- deterministic: level of approval by maintainer
-- stochastic: acceptable standard deviation range from which output parameters
   are calculated
-- camera (or: all cameras)
-- lens (or: all lenses)

3. TO DO:
- clean up the data structure
- write PHP code / forms to populate it
- write PHP code to export XML




# could split into different tables so that additional algorythms
# would get new tables or additional algorythms just make the table
# larger
# xml export format does not really matter, since tags can be
# added/expanded
# so far, there is one table for focal-length only dependent
# corrections and one for the combination of focal-length and aperture

QUESTION:
Does it make sense to add mount information in cl_camera2lens?
or even in an extra table?


#--------------------------------------------------------
# Table:        ur_user
# Date:         2007-may-11
# Description:  user static data
#--------------------------------------------------------
CREATE TABLE ur_user (
        # unique user identifier
        ur_uid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
        # first name
        ur_pname CHAR(50),
        # last name
        ur_lname CHAR(50),
        # email
        ur_email CHAR(50),
        # password
        ur_password CHAR(50),
        # status
        ur_status SMALLINT(6) UNSIGNED DEFAULT 0 NOT NULL,
        # keys
        PRIMARY KEY uid(ur_uid)
);



#--------------------------------------------------------
# Table:                ci_calinfo
# Date:                 2007-may-11
# Description:  calibration info settings
#--------------------------------------------------------
CREATE TABLE ci_calinfo (
        # unique set of calibration information
        ci_cid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
        # disambiguation
        ci_lid INT(11) UNSIGNED,
        # project file
        ci_pto CHAR(50),
        # input image 1
        ci_img1 CHAR(50),
        # input image 2
        ci_img2 CHAR(50),
        # input image 3
        ci_img3 CHAR(50),
        # entered lens description
        ci_lens CHAR(100),
        # entered lens description detail
        ci_detail TEXT,
        # entered camera make
        ci_camera CHAR(100),
        # entered manufacturer
        ci_manu CHAR(100),
        # entered camera type
        ci_type TINYINT(2),
        # entered min focal length
        ci_min_fl CHAR(10),
        # entered max focal length
        ci_max_fl CHAR(10),
        # entered max aperture
        ci_max_f CHAR(10),
        # entered conversion factor
        ci_conv CHAR(10),
        # associated distorsion parameters
        ci_did INT(11) UNSIGNED,
        # associated vignetting parameters
        ci_aid INT(11) UNSIGNED,
        # management process: user who entered the calibration
        ci_uid INT(11) UNSIGNED NOT NULL,
        # management process: maintainer assigned to verify
        ci_mid INT(11) UNSIGNED NOT NULL,
        # management process: status of the data
        ci_status TINYINT(2) UNSIGNED DEFAULT 0,

# add timestamps
# add keys
# add hugin version information
# add contributing software / version
)

#--------------------------------------------------------
# Table:        cl_camera2lens
# Date:         2007-may-11
# Description:  entry for camera in the lens
#--------------------------------------------------------
CREATE TABLE cl_camera2lens (
        # identifier of camera
        cl_cid int(11) UNSIGNED NOT NULL,
        # identifier of lens
        cl_lid int(11) UNSIGNED NOT NULL,
        # keys
        PRIMARY KEY (cl_cid, cl_lid)
);

#--------------------------------------------------------
# Table:                ls_lens
# Date:                 2007-may-11
# Description:  static lens info
#--------------------------------------------------------
CREATE TABLE ls_lens (
        # unique lens/camera identifier - also used
        # for disambiguation in the XML output
        ls_lid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
        # lens description (can be ambiguous)
        ls_lens CHAR(50),
        # lens/camera details
        ls_details TEXT,
        # crop factor belongs theoretically to the camera
        # but has an influence on the correction params
        # and is used only for disambiguation
        ls_crop DECIMAL(3,2),
        # min focal length
        ls_min_fl DECIMAL(5,0),
        # max focal length
        ls_max_fl DECIMAL(5,0),
        # max aperture
        ls_max_f DECIMAL(3,1),
        # lens type
        ls_type TINYINT(2) UNSIGNED NOT NULL,
        # management process: maintainer responsible for this entry
        ls_mid INT(11) UNSIGNED NOT NULL,
        # management process: status of the data
        ls_status TINYINT(2) UNSIGNED DEFAULT 0,
        # keys
        KEY t(ls_type),
        PRIMARY KEY (ls_lid)
)

#--------------------------------------------------------
# Table:                ca_camera
# Date:                 2007-may-11
# Description:  static camera info
#--------------------------------------------------------
CREATE TABLE ca_camera (
        # unique camera identifier
        ca_cid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
        # manufacturer
        ca_manu CHAR(50),
        # camera text description
        ca_camera CHAR(50),
        # crop factor 
        ca_crop DECIMAL(3,2),
        # camera type
        ca_type TINYINT(2),
        # keys
        PRIMARY KEY (ca_cid),
        KEY c(ca_camera),
        KEY m(ca_manu),
        KEY t(ca_type)
)


#--------------------------------------------------------
# Table:                fl_focal
# Date:                 2007-may-11
# Description:  entry for a single focal length
#--------------------------------------------------------
CREATE TABLE fl_focal (
        # unique focal length identifier
        fl_fid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
        # applicable focal length
        fl_fl SMALLINT(5) UNSIGNED,
        # management process: user responsible for this entry
        fl_uid INT(11) UNSIGNED NOT NULL,
        # management process: status of the data
        fl_status TINYINT(2) UNSIGNED DEFAULT 0,
        # keys
        PRIMARY KEY (fl_fid),
        KEY uid(fl_uid),
        KEY status(fl_status)
)

#--------------------------------------------------------
# Table:                dp_distorsion
# Date:                 2007-may-11
# Description:  perspective distorsion and chromatic
#                               aberration parameters that depends only
#                               on the focal length.
#                               multiple / ambiguous entries possible
#--------------------------------------------------------
CREATE TABLE dp_distorsion (
        # unique identifier for this set of parameters
        dp_did INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
        # unique focal length id to which this aperture belongs
        dp_fid INT(11) UNSIGNED,
        # radial distortion correction parameters, as in PTLens
        dp_a DECIMAL(10,7),
        dp_b DECIMAL(10,7),
        dp_c DECIMAL(10,7),
        # transverse chromatic aberration red
        dp_tcar_a DECIMAL(10,7),
        dp_tcar_b DECIMAL(10,7),
        dp_tcar_c DECIMAL(10,7),
        # transverse chromatic aberration blue
        dp_tcab_a DECIMAL(10,7),
        dp_tcab_b DECIMAL(10,7),
        dp_tcab_c DECIMAL(10,7),
        # management process: user that entered the data
        dp_uid INT(11) UNSIGNED NOT NULL,
        # management process: status of the data
        dp_status TINYINT(2) UNSIGNED DEFAULT 0,
        # keys
        PRIMARY KEY (dp_did),
        KEY fid(dp_fid),
        KEY uid(dp_uid),
        KEY status(dp_status)
)


#--------------------------------------------------------
# Table:                vi_vignetting
# Date:                 2007-may-11
# Description:  parameters for a single aperture
#--------------------------------------------------------
CREATE TABLE vi_vignetting (
        # unique aperture/vignetting identifier
        vi_vid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
        # unique focal length id to which these aperture
        # vignetting parameters belongs
        vi_fid INT(11) UNSIGNED,
        # applicable aperture
        vi_ap DECIMAL(3,1) UNSIGNED,
        # vignetting correction
        vi_b DECIMAL(10,7),
        vi_c DECIMAL(10,7),
        vi_d DECIMAL(10,7),
        # management process: user that entered the data
        vi_uid INT(11) UNSIGNED NOT NULL,
        # management process: status of the data
        vi_status TINYINT(2) UNSIGNED DEFAULT 0,
        # primary key
        PRIMARY KEY (vi_aid),
        KEY fid(vi_fid),
        KEY uid(vi_uid),
        KEY status(vi_status)
)
        

_______________________________________________
CREATE mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/create

Reply via email to