A Pixel-Wise Varifocal Camera Model for Efficient Forward Projection

Table of Contents(I) [Fold]

  • Introduction
  • Source code
    • License
    • Download links
  • How to use the code
    • Usage
    • Test data
  • Contact

Introduction †

This page provides an implementation of our pixel-wise varifocal camera model (PVCM) for efficient forward projection in water presented as

Ryo Kawahara, Shohei Nobuhara, Takashi Matsuyama: A Pixel-Wise Varifocal Camera Model for Efficient Forward Projection and Linear Extrinsic Calibration of Underwater Cameras with Flat Housings, ICCV2012 Underwater Vision Workshop.
  • bibtex:
    @inproceedings{kawahara13pixelwise,
      title = {A Pixel-Wise Varifocal Camera Model for Efficient Forward Projection and Linear Extrinsic Calibration of Underwater Cameras with Flat Housings},
      author = {Ryo Kawahara and Shohei Nobuhara and Takashi Matsuyama},
      booktitle = {Proc.\ of ICCV2013 Workshop on Underwater Vision},
      pages = {819--824},
      year = {2013},
    }

The motivation of this project is to realize an efficient forward projection for underwater cameras with flat housings. As proven by Agrawal et al in CVPR2012, computing the projection of a 3D point in water analytically requires solving a 12-th degree polynomial in general, and hence time-consuming if applied for computer vision techniques relying on the forward projections.

The key point to realize the efficient projection is to //compile// the refraction information as a pixel-wise focal length; meaning that we introduce a new virtual camera whose focal length is pixel-dependent.

The following source code is a Matlab implementation of our efficient forward projection described in the above-mentioned paper.

↑

Source code †

↑

License †

This source code is provided under the BSD 3-Clause license, except

  • SolveForwardProjectionCase3.m
  • RefractedRay.m

These files are originally written by the authors of

Amit Agrawal, Srikumar Ramalingam, Yuichi Taguchi and Visesh Chari: "A Theory of Multi-Layer Flat Refractive Geometry", CVPR2012

Please follow the original license for these two.

Copyright (c) 2013, Ryo Kawahara, Shohei Nobuhara and Takashi Matsuyama
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
   * Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.
   * Neither the name of the Graduate School of Informatics, Kyoto
     University, Japan nor the names of its contributors may be used to
     endorse or promote products derived from this software without specific
     prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
↑

Download links †

If you use this software, please consider citing the aforementioned paper in any resulting publication.

  • Matlab version with test data: filepvcm-v1.0.zip (tested with Matlab 2013a)
↑

How to use the code †

↑

Usage †

After unzipping the downloaded file, you will have the following files in a single directory named "pvcm".

  • LICENSE.txt : License
  • demo.m : a demo program
  • synthesize_data.m : test data generator
  • data/*.mat : test data generated by synthesize_data.m
  • @Camera/ : class to store the original camera info
  • @VariCamera/ : class to implement our PVCM
  • SolveForwardProjectionCase3.m : implementation by Agrawal CVPR2012
  • RefractedRay.m : implementation by Agrawal CVPR2012

Start Matlab, and chage the working directory to the "pvcm" directory. Run "demo.m" and you should see the following outputs and a pop-up window that visualizes the results in 3D.

>> demo
Average costs of 400 forward projections:

  by Agrawal 2012 (with for loop)           = 0.003276 sec
  by PVCM-Newton (with for loop)            = 0.000918 sec
  by PVCM-Recurrrent-Newton (with for loop) = 0.000717 sec
  by PVCM-Recurrrent (with for loop)        = 0.000284 sec
  by PVCM-Newton (w/o for loop)             = 0.000079 sec
  by PVCM-Recurrrent-Newton (w/o for loop)  = 0.000059 sec
  by PVCM-Recurrrent (w/o for loop)         = 0.000029 sec

Maximum projection errors in comparison with Agrawal 2012

  by PVCM-Newton                            = 0.000000 px
  by PVCM-Recurrrent-Newton                 = 0.000000 px
  by PVCM-Recurrrent                        = 0.033087 px
↑

Test data †

You can re-generate the test 3D points by

>> synthesize_data

This overwrites the .mat files in "./data/" directory.

↑

Contact †

  • Shohei NOBUHARA
  • Ryo KAWAHARA, Shohei NOBUHARA and Takashi MATSUYAMA: A Pixel-Wise Varifocal Camera Model for Efficient Forward Projection and Linear Extrinsic Calibration of Underwater Cameras with Flat Housings, ICCV2012 Underwater Vision Workshop.
  • Copyright © 2013 - Kyoto University