On Github

movie-fleur 🌻

Convert 3D movies with split frames to Anaglyph 3D movies for viewing with red (blue/cyan/green) 3D glasses.

Convert from Video File with Frame Position

If a 3D video is available, frames can be extracted by specifying the frame position. 3D video files can be found here.

BufferedImage frame = FleurVideo.extract(new File("3dVideo.mp4"), 6000);

List<BufferedImage> splited = Fleur3dUtil.split(frame);
BufferedImage frameCombined = FleurFilter.additive(
        FleurFilter.color(splited.get(0), ColorMask.RED),
        FleurFilter.color(splited.get(1), ColorMask.CYAN));

ImageHelper.saveImage(frameCombined, "frame_combined.png");

Steps to Convert

1. Extract Frames from Video File

Extract Frames

FleurVideo.extract(new File("3dVideo.mp4"), 6000);

2. Split and Stretch Frames

Left FrameRight Frame
Left FrameRight Frame
List<BufferedImage> splited = Fleur3dUtil.split(frame);

3. Combine Frames without Color Filtering

Combined Frame

BufferedImage combined = FleurFilter.alphaCombine(frame1, frame2);

4. Apply Color Filters

Left Frame with Red FilterRight Frame with Cyan Filter
Red FilterCyan Filter
BufferedImage redFilterImg = FleurFilter.color(splited.get(0), FilterColor.RED);
BufferedImage greenBlueFilterImg = FleurFilter.color(splited.get(1), FilterColor.CYAN);

5. Combine Frames with Additive Filtering

Filtered Combined Frame

BufferedImage additiveCombinedFrame = FleurFilter.additive(
        FleurFilter.color(splited.get(0), FilterColor.RED),
        FleurFilter.color(splited.get(1), FilterColor.CYAN)
);

6. Compile to Video

Compiled Video

List<BufferedImage> images = FleurVideo.extract(new File("3dVideo.mp4"), 6000, 6010);
List<BufferedImage> videoImages = new ArrayList<>();

for (BufferedImage image : images) {
    List<BufferedImage> splits = Fleur3dUtil.split(image);

    videoImages.add(FleurFilter.additive(
            FleurFilter.color(splits.get(0), ColorMask.RED),
            FleurFilter.color(splits.get(1), ColorMask.CYAN)
    ));
}

FleurVideo.create(videoImages, "3dVideoOut.mp4");

7. Compile to Polarized 3D Video (Left/Right)

Left VideoRight Video
Left VideoRight Video
List<BufferedImage> images = FleurVideo.extract(new File("3dVideo.mp4"), 6000, 6100);
List<BufferedImage> leftArray = new ArrayList<>();
List<BufferedImage> rightArray = new ArrayList<>();

for (BufferedImage image : images) {
    List<BufferedImage> splits = Fleur3dUtil.split(image);
    leftArray.add(splits.get(0));
    rightArray.add(splits.get(1));
}

FleurVideo.create(leftArray, "left.mp4");
FleurVideo.create(rightArray, "right.mp4");

To view: play both videos on separate projectors or use active shutter 3D glasses on a 60Hz monitor.

Further Filters

Filter NameExampleCode Snippet
DefaultDefaultDefault rendering
Additive Blue YellowBlue YellowFleurFilter.additive(FleurFilter.color(splits.get(0), ColorMask.BLUE), FleurFilter.color(splits.get(1), ColorMask.YELLOW));
Additive Green MagentaGreen MagentaFleurFilter.additive(FleurFilter.color(splits.get(0), ColorMask.GREEN), FleurFilter.color(splits.get(1), ColorMask.MAGENTA));
IndexedIndexedImageHelper.convertToType(frame, BufferedImage.TYPE_BYTE_INDEXED)
RedRedFleurFilter.color(frame, ColorMask.RED)
GreenGreenFleurFilter.color(frame, ColorMask.GREEN)
BlueBlueFleurFilter.color(frame, ColorMask.BLUE)
CyanCyanFleurFilter.color(frame, ColorMask.CYAN)
GrayGrayFleurFilter.gray(frame)
BinaryBinaryImageHelper.convertToType(frame, BufferedImage.TYPE_BYTE_BINARY)
Transparent (0.5)TransparentFleurFilter.transparent(frame, 0.5)
InvertInvertFleurFilter.invert(frame)