Coder Social home page Coder Social logo

lfptools's Introduction

Platform independent tools for working with Lytro LFP files
===========================================================

Lytro has not announced much about their file formats other than that they
have software for OS X and will have Windows supported in 2012.  To enable 
support for other platforms, it will be useful to develop open source software
to process their files.

This tool supports both the large raw files that come from the Lytro camera
and the compressed files that the desktop software produces for web display.

Note: The description below refers to .lfp file format for files generated
using Lytro's Version 1 processing software. See README_V2 for a description
of .lfp format changes as of Lytro's December 2012 update (Version 2).

.lfp file format
----------------

The file itself is formatted as follows.  First, a header:

    # magic 12 byte header (LFP)
    89 4C 46 50 0D 0A 1A 0A 00 00 00 01
    # 4 byte length (0, since there is nothing in this section)
    00 00 00 00
    
After this are a number of sections.  The data in the first is plain text
JSON table of contents describing what the rest of the sections in the file
contain.  The remaining sections can be additional metadata, a depth lookup
table, compressed jpg images, or raw sensor data depending on the file.
The sections are formatted as follows:
    
    # magic 12 byte header (containing a type like LFM or LFC)
    89 4C 46 4D 0D 0A 1A 0A 00 00 00 00
    # 4 byte length, not including header, sha1, or null padding
    00 00 07 A7
    # 45 bytes of sha1 hash as hex in ascii
    73 68 61 31 ...
    # 35 bytes of null padding
    00 00 00 00 ...
    # the data of length previously specified
    7B 22 70 69 ...
    # 0 or more bytes of null padding
    00 00 00 00 ...

.lfp web files
--------------

The Lytro desktop app exports compressed representations of the light field
captured by the Lytro camera to reduce file times and rendering requirements
for web display.  The .lfp files are simply a set of JPEG files representing
the unique visually interesting sections of the light field.  That is, a set in
which each image shows a different area in focus.  It appears to do so
dynamically, picking the minimum number of images necessary to show all
*focusable* objects in narrow depths of field.

These images are stored along with their estimated depths and a depth lookup
table for the image.  This allows for HTML5 and Flash applications in which the
user clicks on a region of the image, the value of that region is looked up,
and the depth image closest to that value is displayed.

.lfp raw files
--------------
The files that come directly from the camera are roughly 16MB, made primarily
of one section which is a raw Bayer array of the 3280 x 3280 pixel sensor.
There are also two metadata files, one containing detailed information about
the format of the captured image, and the other containing serial numbers.

lfpsplitter
-----------

lfpsplitter is a commandline tool that reads in a .lfp file and splits it into
a plaintext metadata file, a plaintext listing of the depth lookup table, and
the component jpgs.

    make
        gcc -O3 -Wall    -c -o lfpsplitter.o lfpsplitter.c
        gcc -o lfpsplitter lfpsplitter.o  -O3 -Wall 

    ./lfpsplitter IMG_0001.lfp
        Saved IMG_0001_table.json
        Saved IMG_0001_imageRef0.raw
        Saved IMG_0001_metadataRef.json
        Saved IMG_0001_privateMetadataRef.json

    ./lfpsplitter IMG_0001-stk.lfp
        Saved IMG_0001-stk_table.json
        Saved IMG_0001-stk_depth.txt
        Saved IMG_0001-stk_0.jpg
        Saved IMG_0001-stk_1.jpg
        Saved IMG_0001-stk_2.jpg
        Saved IMG_0001-stk_3.jpg

lfptools's People

Contributors

eclecticc avatar eweidaw avatar nrpatel avatar syoyo avatar tzafrir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lfptools's Issues

Will this project be continued?

Hi,
I just bought a Lytro camera, being a front end web developer I would love to see an API for the Lytro web files. For instance events data on the onclick event with say distance of the point clicked, which jpeg to use and so on. Also a method which would allow for setFocus(distance)

Are you guys aware of any official support from Lytro? Oh, and a precompiled version of your tool (for Mac OSX Mountain Lion) would be appreciated! :-)

/Sten

Depth missing from stack image

./lfpsplitter ./TestStack.lfp
Saved ./TestStack_table.json
Saved ./TestStack_metadataRef0.json
Saved ./TestStack_imageRef0.raw
Saved ./TestStack_00.jpg
Saved ./TestStack_01.jpg
Saved ./TestStack_02.jpg
Saved ./TestStack_03.jpg
Saved ./TestStack_04.jpg
Saved ./TestStack_05.jpg
Saved ./TestStack_06.jpg
Saved ./TestStack_07.jpg
Saved ./TestStack_08.jpg
Saved ./TestStack_09.jpg
Saved ./TestStack_10.jpg
Saved ./TestStack_11.jpg

The depth.txt was missing

Cannot split JPEGs

When I split a *-stk.lfp file, I do not get any JPEGs. Only the following files.

  • IMG_0030-stk_table.json
  • IMG_0030-stk_imageRef0.raw
  • IMG_0030-stk_blockOfImagesRef0.json
  • IMG_0030-stk_blockOfImagesRef1.json

Did Lytro change something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.