Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.
/ python-lfp-reader Public archive

LFP (Light Field Photography) File Reader in Python

License

Notifications You must be signed in to change notification settings

behnam/python-lfp-reader

Repository files navigation

LFP (Light Field Photography) File Reader

<http://code.behnam.es/python-lfp-reader>

Version 2.0

Provides a Python library and command-line scripts to read Lytro LFP files. There is also an enhanced viewer for Lytro LFP Picture files supporting light-field picture refocusing and enhanced-depth-of-field/parallax view.

This version supports picture files generated by Lytro Desktop application version 2.0.

Technically, there are two types of LFP files: Picture and Storage. LFP Storage files are used to store the data and configurations for Lytro cameras, and LFP Picture (.lfp) files are used to store RAW and/or processed data for Lytro light-field pictures.

How to Install

Dependencies

This is a pure-Python package and should work on any platform, but some functionalities depend on external Python and non-Python libraries.

Install in Ubuntu

Run following commands in a terminal:

sudo apt-get install libjpeg-dev python-gst0.10 gstreamer0.10-plugins-ugly python-pip

sudo pip install https://github.com/behnam/python-lfp-reader/tarball/master

LFP File Format

LFP is a new file format used by Lytro Cameras and Lytro Desktop app for RAW and Processed picture files, as well as storing camera software and information.

LFP Picture files have a .lfp extension, and among these, the name of the processed picture files end in -stk.lfp, where stk stands for refocuse "stack". Embadding JPEG data with some additional refocus data, the stk.lfp files are designed to be used in the Lytro Desktop application and on the web.

LFP Storage files embed various data files, which are identified by a pathname, i.e. C:\CALIB\WIFI_MAC_ADDR.TXT.

LFP Viewer

lfp-viewer.py

An enhanced light-field picture viewer, suppring refocus and enhanced depth-of-field/parallax features.

You may provide the name of the Processed LFP Picture file in the command-line.:

./lfp-viewer.py samples/IMG_0001-stk.lfp

Command-line Scripts

This package provides the following command-line scripts.

lfp-file.py

Sub-command: info

Prints general information about any LFP file, including the metadata and data chunks (their size and sha1 ids).:

./lfp-file.py info samples/IMG_0003.lfp

Sub-command: export

Exports metadata and data sections of a generic file into separate files.:

./lfp-file.py export samples/IMG_0001.lfp

Sub-command: extract

Extract the content of a data chunk to standard output, giving its SHA1 id.:

./lfp-file.py extract samples/IMG_0001.lfp sha1-992ae2d9f755077e50de7b9b1357e873885b3382

lfp-picture.py

Sub-command: info

Provides detailed information about the LFP Picture file.:

./lfp_picture_info.py samples/IMG_0003.lfp

The Frame section provides the information about the RAW picture data.

the Refocus-Stack section tells you about the processed image data for refocues feature, including the number of refocues images and the size of the depth table.

the Parallax-Stack section tells you about the processed image data for EDoF/Parallax feature, including the number of parallax images.

Sub-command: exporter

Exports raw, processed data and an all-in-focus image of the LFP Picture file into separate files.:

./lfp_picture_exporter.py samples/IMG_0001.lfp
./lfp_picture_exporter.py samples/IMG_0001-stk.lfp

lfp-storage.py

Sub-command: info

Prints general information about any LFP Storage file, including a list of embedded data files (their path and size).:

./lfp-storage.py info samples/IMG_0003.lfp

Sub-command: export

Exports metadata and embedded files of an LFP Storage file into separate files.:

./lfp-storage.py export samples/IMG_0001.lfp

Sub-command: extract

Extract the content of an embedded file to standard output, giving its path.:

./lfp-storage.py extract samples/IMG_0001.lfp "C:\\CALIB\\ACC.TXT"

LFP Reader Library

LFP Reader library (``lfp_reader``) provides direct reading access to all data and metadata in any LFP files. For the processed LFP Picture files, you can easily access the refocused and parallax data and the depth table. And for LFP Storage files, you can access embedded files easily using their pathname.

For more details, look at the module documentation.

Code License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Legal Notice

This project is NOT affiliated with LYTRO, INC. Lytro (R) is a trademark of LYTRO, INC. <http://www.lytro.com/>

This project uses GStreamer plugins for H.264 decoding, thus includes no implementation of H.264 algorithms.

Some of this work is based on Nirav Patel's lfptools project and his analysis on LFP file format. <https://github.com/nrpatel/lfptools>

Copyright (C) 2012-2013 Behnam Esfahbod. <http://behnam.es/>

Please report any problems at <https://github.com/behnam/python-lfp-reader/issues>.

About

LFP (Light Field Photography) File Reader in Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published