Adjusting parallax in MPO stereo images
MPO stereo images, that were taken in example using Fujifilm FinePix Real 3D Cameras contain a field parallax in their exif data. The parallax value can be used by stereoscopic viewers like my stereoscopic image viewer SIV to adjust the 3D effect. By manipulating this value one can can customize the strength of the pop out effect and reduce the ghosting effect. This may lead to a more pleasuring viewing experience.
The parallax value can easily be displayed using exiftool:
exiftool -ee -Parallax DSCF0045.MPO
If you want to set the parallax value of an image, this is not that easy, since the value is stored in the exif data of the second embedded jpeg file in the MPO, which is not directly writable with exiftool. However one can find out the beginning of the second file with exiftool, extract the image and then set the parallax value. Afterwards on can put all together again using dd. Doing this manually is a quite awful task, so I wrote a little script for automating it:
#!/bin/bash
#setparallax.sh
#$1: MPO File $2: Parallax value
MPSTART=`exiftool -b -MPImageStart $1`
echo Multipart Image 2 begins at: $MPSTART
let MPSTART=$MPSTART/64
cp -a $1 $1.orig
exiftool $1.orig -mpimage2 -b | exiftool -b -Parallax=$2 – \
| dd conv=notrunc bs=64 seek=$MPSTART of=$1
Use it at the command line as follows:
setparallax.sh [MPO-File] [new parallax value]
in example:
setparallax.sh DSCF0045.MPO 1.25
For determining the value that matches the visual requirements of your image you may use the parallax adjustment function of SIV (+/- key) and use the value on the OSD and printed out in the console. Perhaps some day I will add the functionality, to directly write the new parallax value to the MPO file, to SIV. However the setparallax script at least gives us the possibility to write the parallax value until then.
Jürgen
February 27th, 2013 at 8:01 pm
Hi,
I am writing a simple MPO Tool in python + GTK+3 at the moment. I was looking for a method to write Parallax Tags and found your script. The problem is, it does not work 🙂 When using the script in the command line, it does not know what to do with that symbol: ‘–’
If using ‘-‘ instead it works but corrupts the MPO file. What am I doing wrong :D?
Cheers,
Gem
February 27th, 2013 at 8:23 pm
Hi Gen,
I have tried the script again and it works as expected. Then I have tried to copy the script from the blog, and as you have reported, the hyphen has to be replaced manually. Unfortunately WordPress seems to replace the hyphen with a “longer” hyphen, that is not being understood by bash. However, if I replace the hyphen manually, the script works and produces a valid MPO image.
The image I have tried is from a Fujifilm Finepix 3D W1 camera. From which source does your image come from? Could you send the image for testing? Most probably the script does not work with MPOs from all sources, but to find this out I have to try your image. If this is true, perhaps I can find a way to correct this.
Best regards
Jürgen
December 25th, 2015 at 3:36 pm
There some good info in that script, thanks 😉
(On the scripting side itself though, don’t put extensions on command names – scripts often get rewritten in other languages and then the extension, now wrong, has to be kept to stay compatible. Plus, “.sh” is actually wrong anyway. The #!/bin/bash already does everything you need, the “.sh” is just a problem.)