Added EXIF metadata.

Signed-off-by: Mark Hale <mark.hale@physics.org>
Former-commit-id: 917c6a7973
pull/1161/head
Mark Hale 2017-02-22 22:05:48 +00:00
rodzic d309ce91c5
commit 1ec5862969
3 zmienionych plików z 37 dodań i 4 usunięć

Wyświetl plik

@ -1,6 +1,7 @@
#!/usr/bin/env python
# Renders a photo.
# ExifTool must be on your PATH.
# To generate a 360 panoramic photo:
# blender -b photo_360.blend --python odm_photo.py -- <project-path>
# To generate a 360 3D panoramic photo:
@ -10,6 +11,7 @@
import sys
import bpy
import materials_utils
import subprocess
surfaceShaderType = 'ShaderNodeEmission'
surfaceShaderName = 'Emission'
@ -26,7 +28,7 @@ def main():
bpy.ops.import_scene.obj(filepath=projectHome +
'/odm_texturing/odm_textured_model_geo.obj',
axis_forward='Y', axis_up='-Z')
axis_forward='Y', axis_up='Z')
bpy.ops.xps_tools.convert_to_cycles_all()
@ -48,7 +50,7 @@ def main():
minZ = min(z, minZ)
maxZ = max(z, maxZ)
model.location[2] += minZ
model.location[2] += (maxZ - minZ)/2
for m in bpy.data.materials:
nt = m.node_tree
@ -61,10 +63,41 @@ def main():
nt.nodes['Diffuse Texture'].outputs[0])
blendName = bpy.path.display_name_from_filepath(bpy.data.filepath)
bpy.data.scenes['Scene'].render.filepath = projectHome +
'/odm_photo/odm_' + blendName + '.jpg'
fileName = projectHome + '/odm_photo/odm_' + blendName
render = bpy.data.scenes[0].render
render.filepath = fileName
bpy.ops.render.render(write_still=True)
width = render.resolution_x
height = render.resolution_y
if(render.use_multiview):
writeExif(fileName+render.views[0].file_suffix+'.jpg', width, height)
writeExif(fileName+render.views[1].file_suffix+'.jpg', width, height)
else:
writeExif(fileName+'.jpg', width, height)
def writeExif(fileName, width, height):
w = str(width)
h = str(height)
subprocess.run(['exiftool',
'-overwrite_original',
'-CroppedAreaImageWidthPixels=' + w,
'-CroppedAreaImageHeightPixels=' + h,
'-FullPanoWidthPixels=' + w,
'-FullPanoHeightPixels=' + h,
'-CroppedAreaLeftPixels=0',
'-CroppedAreaTopPixels=0',
'-ProjectionType=equirectangular',
'-UsePanoramaViewer=True',
'-PoseHeadingDegrees=0',
'-LargestValidInteriorRectLeft=0',
'-LargestValidInteriorRectTop=0',
'-LargestValidInteriorRectWidth=' + w,
'-LargestValidInteriorRectHeight=' + h,
fileName])
if __name__ == '__main__':
main()

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.