Shortcuts

mmedit.models.editors.inst_colorization.color_utils

Module Contents

Functions

xyz2rgb(xyz)

Conversion images from xyz to rgb.

lab2xyz(lab)

Conversion images from lab to xyz.

lab2rgb(lab_rs, color_data_opt)

Conversion images from lab to rgb.

encode_ab_ind(data_ab, color_data_opt)

Encode ab value into an index.

rgb2xyz(rgb)

Conversion images from rgb to xyz

xyz2lab(xyz)

Conversion images from xyz to lab

rgb2lab(rgb, color_opt)

Conversion images from rgb to lab.

get_colorization_data(data_raw, color_opt[, num_points])

Conversion images from rgb to lab.

add_color_patches_rand_gt(data, color_opt[, p, ...])

Add random color points sampled from ground truth based on: Number of

mmedit.models.editors.inst_colorization.color_utils.xyz2rgb(xyz)[源代码]

Conversion images from xyz to rgb.

参数

xyz (tensor) – The images to be conversion

返回

The converted image

返回类型

out (tensor)

mmedit.models.editors.inst_colorization.color_utils.lab2xyz(lab)[源代码]

Conversion images from lab to xyz.

参数

lab (tensor) – The images to be conversion

返回

The converted image

返回类型

out (tensor)

mmedit.models.editors.inst_colorization.color_utils.lab2rgb(lab_rs, color_data_opt)[源代码]

Conversion images from lab to rgb.

参数
  • lab_rs (tensor) – The images to be conversion

  • color_data_opt (dict) – Config for image colorspace transformation. Include: l_norm, ab_norm, l_cent

返回

The converted image

返回类型

out (tensor)

mmedit.models.editors.inst_colorization.color_utils.encode_ab_ind(data_ab, color_data_opt)[源代码]

Encode ab value into an index.

参数
  • data_ab – Nx2xHxW from [-1,1]

  • color_data_opt – Config for image colorspace transformation. ab_max, ab_quant, ab_norm, ab_quant

返回

Nx1xHxW from [0,Q)

mmedit.models.editors.inst_colorization.color_utils.rgb2xyz(rgb)[源代码]

Conversion images from rgb to xyz rgb from [0,1] xyz_from_rgb = np.array([[0.412453, 0.357580, 0.180423],

[0.212671, 0.715160, 0.072169], [0.019334, 0.119193, 0.950227]])

参数

rgb (Tensor) – image in rgb colorspace

返回

image in xyz colorspace

返回类型

xyz (Tensor)

mmedit.models.editors.inst_colorization.color_utils.xyz2lab(xyz)[源代码]

Conversion images from xyz to lab xyz from [0,1] factors: 0.95047, 1., 1.08883

参数

xyz (Tensor) – image in xyz colorspace

返回

Image in lab colorspace

返回类型

out (Tensor)

mmedit.models.editors.inst_colorization.color_utils.rgb2lab(rgb, color_opt)[源代码]

Conversion images from rgb to lab.

参数
  • data_raw (tensor) – The images to be conversion

  • color_opt (dict) – Config for image colorspace transformation. Include: ab_thresh, ab_norm, sample_PS, mask_cent

返回

The converted image

返回类型

out (tensor)

mmedit.models.editors.inst_colorization.color_utils.get_colorization_data(data_raw, color_opt, num_points=None)[源代码]

Conversion images from rgb to lab.

参数
  • data_raw (tensor) – The images to be conversion

  • color_opt (dict) – Config for image colorspace transformation. Include: ab_thresh, ab_norm, sample_PS, mask_cent

返回

Output in add_color_patches_rand_gt

返回类型

results (dict)

mmedit.models.editors.inst_colorization.color_utils.add_color_patches_rand_gt(data, color_opt, p=0.125, num_points=None, use_avg=True, samp='normal')[源代码]

Add random color points sampled from ground truth based on: Number of points.

  • if num_points is 0, then sample from geometric distribution,

    drawn from probability p

  • if num_points > 0, then sample that number of points

Location of points - if samp is ‘normal’, draw from N(0.5, 0.25) of image - otherwise, draw from U[0, 1] of image

参数
  • data (tensor) – The images to be conversion

  • color_opt (dict) – Config for image colorspace transformation Include: ab_thresh, ab_norm, sample_PS, mask_cent

  • p (float) – Sampling geometric distribution, 1.0 means no hints

  • num_points (int) – Certain number of points

  • use_avg (bool) – Whether to use the mean when add color point Default: True.

  • samp (str) – Geometric distribution or uniform distribution when sample location. Default: normal.

返回

Result dict from :obj:mmcv.BaseDataset.

返回类型

results (dict)

Read the Docs v: latest
Versions
master
latest
stable
zyh-doc-notfound-extend
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.