Esempio n. 1
0
import os
from time import time

import numpy as np
from numpy import linalg
from scipy.special._ufuncs import gammaincinv, gamma
from toolbox.images import resize

from rendkit.pfm import pfm_read, pfm_write
from toolbox import images
from toolbox.logging import init_logger

logger = init_logger(__name__)

MAP_DIFF_FNAME = 'map_diff.pfm'
MAP_SPEC_FNAME = 'map_spec.pfm'
MAP_NORMAL_FNAME = 'map_normal.pfm'
MAP_SPEC_SHAPE_FNAME = 'map_spec_shape.pfm'
MAP_PARAMS_FNAME = 'map_params.dat'
IS_SIGMA_RANGE_FNAME = 'is_sigma_range.dat'
IS_CDF_FNAME = 'is_cdf_sampler.pfm'
IS_PDF_FNAME = 'is_pdf_sampler.pfm'


class AittalaSVBRDF:
    @classmethod
    def from_path(cls, path):
        return cls(path)

    def __init__(self,
                 path=None,
Esempio n. 2
0
from typing import Tuple, Iterable

import sqlalchemy as sa
from sqlalchemy import func
from sqlalchemy.orm import joinedload

from terial import config, models
from terial.models import (ExemplarShapePair, Exemplar, Material, Shape,
                           ResultAnnotation)
from toolbox import logging

logger = logging.init_logger(__name__)


def fetch_exemplars(sess,
                    page_size=None,
                    page=0,
                    order_by=Exemplar.id.asc(),
                    skip_excluded=True,
                    filters=None) -> Tuple[Iterable[Exemplar], int]:
    if filters is None:
        filters = []
    else:
        filters = [f for f in filters]

    if skip_excluded:
        filters.append(ExemplarShapePair.shape.has(exclude=False))

    query = (sess.query(Exemplar).order_by(order_by).filter(sa.and_(*filters)))
    count = query.count()