Example #1
0
def fit_reflectance_model(model_type, L, ori_r, r, ori_ndotl, ndotl,
                          fit_falloff, width, height, *extra_params):
    # determine which reflectance model function to use
    if model_type == sfs.LAMBERTIAN_MODEL:
        model_func = reflectance_models.fit_lambertian
    elif model_type == sfs.OREN_NAYAR_MODEL:
        model_func = reflectance_models.fit_oren_nayar
    elif model_type == sfs.PHONG_MODEL:
        model_func = reflectance_models.fit_phong
    elif model_type == sfs.COOK_TORRANCE_MODEL:
        model_func = reflectance_models.fit_cook_torrance
    elif model_type == sfs.POWER_MODEL:
        model_func = reflectance_models.fit_power_model

    if not fit_falloff:
        falloff = 1.5
        model_params, residual = model_func(L, ori_r, r, ori_ndotl, ndotl,
                                            width, height, *extra_params)
    else:
        #import pdb;pdb.set_trace()
        falloff, model_params, residual = reflectance_models.fit_with_falloff(
            L, ori_r, r, ori_ndotl, ndotl, width, height, model_func,
            *extra_params)

    print 'Residual =', residual
    print 'Falloff = ', falloff

    return falloff, model_params, residual
Example #2
0
def fit_reflectance_model(model_type, L, r, ndotl, fit_falloff, *extra_params):
  # determine which reflectance model function to use
  if model_type == sfs.LAMBERTIAN_MODEL:
    model_func = reflectance_models.fit_lambertian
  elif model_type == sfs.OREN_NAYAR_MODEL:
    model_func = reflectance_models.fit_oren_nayar
  elif model_type == sfs.PHONG_MODEL:
    model_func = reflectance_models.fit_phong
  elif model_type == sfs.COOK_TORRANCE_MODEL:
    model_func = reflectance_models.fit_cook_torrance
  elif model_type == sfs.POWER_MODEL:
    model_func = reflectance_models.fit_power_model

  if not fit_falloff:
    falloff = 2.
    model_params, residual = model_func(L, r, ndotl, *extra_params)
  else:
    falloff, model_params, residual = reflectance_models.fit_with_falloff(
        L, r, ndotl, model_func, *extra_params)

  print 'Residual =', residual

  return falloff, model_params, residual
Example #3
0
def fit_reflectance_model(model_type, L, r, ndotl, fit_falloff, *extra_params):
    # determine which reflectance model function to use
    if model_type == sfs.LAMBERTIAN_MODEL:
        model_func = reflectance_models.fit_lambertian
    elif model_type == sfs.OREN_NAYAR_MODEL:
        model_func = reflectance_models.fit_oren_nayar
    elif model_type == sfs.PHONG_MODEL:
        model_func = reflectance_models.fit_phong
    elif model_type == sfs.COOK_TORRANCE_MODEL:
        model_func = reflectance_models.fit_cook_torrance
    elif model_type == sfs.POWER_MODEL:
        model_func = reflectance_models.fit_power_model

    if not fit_falloff:
        falloff = 2.
        model_params, residual = model_func(L, r, ndotl, *extra_params)
    else:
        falloff, model_params, residual = reflectance_models.fit_with_falloff(
            L, r, ndotl, model_func, *extra_params)

    print 'Residual =', residual

    return falloff, model_params, residual
Example #4
0
def fit_reflectance_model(model_type, L, ori_r, r, ori_ndotl,ndotl, fit_falloff,width,height, *extra_params):
  # determine which reflectance model function to use
  if model_type == sfs.LAMBERTIAN_MODEL:
    model_func = reflectance_models.fit_lambertian
  elif model_type == sfs.OREN_NAYAR_MODEL:
    model_func = reflectance_models.fit_oren_nayar
  elif model_type == sfs.PHONG_MODEL:
    model_func = reflectance_models.fit_phong
  elif model_type == sfs.COOK_TORRANCE_MODEL:
    model_func = reflectance_models.fit_cook_torrance
  elif model_type == sfs.POWER_MODEL:
    model_func = reflectance_models.fit_power_model

  if not fit_falloff:
    falloff =1.5
    model_params, residual = model_func(L,ori_r, r,ori_ndotl,ndotl,width,height, *extra_params)
  else:
    #import pdb;pdb.set_trace()
    falloff, model_params, residual = reflectance_models.fit_with_falloff(L,ori_r, r,ori_ndotl,ndotl,width,height, model_func, *extra_params)

  print 'Residual =', residual
  print 'Falloff = ', falloff

  return falloff, model_params, residual