Example #1
0
    def forwards(self, orm):
        # Adding field 'Photo.orig_width'
        db.add_column(
            u'photos_photo',
            'orig_width',
            self.gf('django.db.models.fields.IntegerField')(null=True),
            keep_default=False)

        # Adding field 'Photo.orig_height'
        db.add_column(
            u'photos_photo',
            'orig_height',
            self.gf('django.db.models.fields.IntegerField')(null=True),
            keep_default=False)

        storage = get_opensurfaces_storage()

        Photo = orm['photos.Photo']
        for (id, path) in progress_bar(
                Photo.objects.values_list('id', 'image_orig')):
            try:
                img = Image.open(storage.open(path))
                width, height = img.size
                Photo.objects.filter(id=id).update(orig_width=width,
                                                   orig_height=height)
            except Exception as e:
                print e
    def forwards(self, orm):
        # Adding field 'Photo.orig_width'
        db.add_column(u'photos_photo', 'orig_width',
                      self.gf('django.db.models.fields.IntegerField')(null=True),
                      keep_default=False)

        # Adding field 'Photo.orig_height'
        db.add_column(u'photos_photo', 'orig_height',
                      self.gf('django.db.models.fields.IntegerField')(null=True),
                      keep_default=False)

        storage = get_opensurfaces_storage()

        Photo = orm['photos.Photo']
        for (id, path) in progress_bar(Photo.objects.values_list('id', 'image_orig')):
            try:
                img = Image.open(storage.open(path))
                width, height = img.size
                Photo.objects.filter(id=id).update(
                    orig_width=width, orig_height=height)
            except Exception as e:
                print e
Example #3
0
from colormath.color_objects import RGBColor

from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic

from common.models import UserBase, ResultBase
from common.utils import save_obj_attr_base64_image, get_content_tuple, \
    get_opensurfaces_storage

from shapes.models import Shape, MaterialShape, MaterialShapeLabelBase


BSDF_VERSIONS = ("wd", ) # just Ward for now
STORAGE = get_opensurfaces_storage()


class EnvironmentMap(UserBase):
    """ Environment map used with a BRDF """
    name = models.CharField(max_length=128, unique=True)

    # Tonemapping parameters for [Reinhard 2002, Equation 4]
    # The log_average luminance is baked into the scale as a
    # precomputation.
    #     scale: key / log_average luminance
    #     white: values higher than this will be set to pure white
    tonemap_scale = models.FloatField()
    tonemap_white = models.FloatField()

Example #4
0
import os
import json
import math
import tempfile
import numpy as np
from decimal import Decimal
from colormath.color_objects import RGBColor, LabColor

from django.db import models, transaction

from common.models import EmptyModelBase, ResultBase, PaperCitation
from photos.models import Photo

from common.utils import get_content_tuple, get_opensurfaces_storage

STORAGE = get_opensurfaces_storage()


class IntrinsicSyntheticDecomposition(EmptyModelBase):
    """
    This holds the different layers of a synthetic image.  The final rendered
    result is stored as an LDR JPG in the ``photo`` attribute, and the layers are
    stored in ``multilayer_exr``.  LDR preview thumbnails of each layer are
    stored in ``*_thumb``.
    """

    #: final rendered result as an LDR JPG.
    photo = models.OneToOneField(Photo, related_name='intrinsic_synthetic')

    #: name of the artist that modeled the scene
    scene_artist = models.CharField(max_length=255, blank=True)
Example #5
0
def opensurfaces_storage_transfer(name):
    """ Called by ``common.backends.OpenSurfacesStorage.ensure_local(...)`` """
    from common.utils import get_opensurfaces_storage
    storage = get_opensurfaces_storage()
    storage.ensure_local(name, async=False)
Example #6
0
def opensurfaces_storage_transfer(name):
    """ Called by ``common.backends.OpenSurfacesStorage.ensure_local(...)`` """
    from common.utils import get_opensurfaces_storage
    storage = get_opensurfaces_storage()
    storage.ensure_local(name, async=False)