Created
January 19, 2012 05:37
-
-
Save neuralvis/1638199 to your computer and use it in GitHub Desktop.
A python script to interlace a stereo-pair to show on 3D displays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a script designed to take two images and interlace them. For a usefullness | |
# point of view the images should be left and right eye images which one wishes to | |
# display on a JVC micro-polarized display (or any other display using interlaced | |
# stereo) | |
import Image | |
import sys | |
import numpy | |
def interlace(left, right, stereo): | |
'simple function to interlace 2 images' | |
lefta = numpy.asarray(Image.open(left)) | |
righta = numpy.asarray(Image.open(right)) | |
stereoa = numpy.copy(lefta) | |
count = 0 | |
for row in righta: | |
if count % 2 == 0: | |
stereoa[count,:,:] = row | |
count += 1 | |
stereoi = Image.fromarray(stereoa) | |
stereoi.save(stereo) | |
if __name__ == "__main__": | |
'assumes the arguments are of the form left right stereo' | |
interlace(sys.argv[1], sys.argv[2], sys.argv[3]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment