Perspective Shift Feature breaks lfpsplitter [Lytro]

Perspective Shift feature breaks lfpsplitter (Picture: Lytro Raw camera extract by Nirmal Patel) Those of you who are using lfpsplitter to extract data and image stacks from LightField files have no doubt already noticed this, but we thought we’d bring it out to the open:
With the introduction of the new Perspective Shift feature last December, Lytro has made some changes to the structure of -stk.lfp files which effectively break lfpsplitter’s functionality.

The culprit seems to lie in file compression: Herman Snerd has discovered that “apparently both the perspective shift images and the refocused stack are now encoded in H.264”.

lfpsplitter’s author, Nirmal Patel, has responded to requests for an update, but “won’t have time within the next few months”. If you have the necessary knowledge to update the lfpsplitter code, we’re sure the Lytro community will be grateful!

Update: Lytro’s Director of Photography, Eric Cheng, has just responded via Twitter:

2. Update: There is some code available to help you export the images manually. See the comments for more details.

You may also like...

6 Responses

  1. Erklärbär says:

    I don’t have time to update lfsplitter itself but here a short tutorial how I get the (focal stack and perspective shift) image data from the new lytro format:
    You can still use lfsplitter: lfpsplitter.exe IMG_XXXX-stk.lfp

    The images are then in the two blockOfImages files encoded as h.264 as mentioned in the article. Therefore, you can use ffmpeg ( to decode the files:
    ffmpeg.exe -i IMG_XXXX-stk_blockOfImagesRef0.json -f image2 img_persp_%3d.png
    ffmpeg.exe -i IMG_XXXX-stk_blockOfImagesRef1.json -f image2 img_focal_%3d.png

    (A quick hack to get a readable depth map and confidence map is to disable the converted_image(…) call in lfpsplitter (as they are detected as raw files by the splitter) and read them as 330×330 float arrays.)

    I hope this helps someone to create a more user friendly way to decode the data…

  2. markus says:

    Thanks for taking the time to share your hack, Erklärbär!

  3. Elissa says:

    Some lfpsplitter code for the new file format has been posted at a github fork at Use of ffmpeg is still required for image extraction.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.